私はこのクラスを持っています:
interface Info{}
class AInfo : Info { }
class BInfo : Info { }
class SendInfo {
static public f_WriteInfo(params Info[] _info) {
}
}
class Test {
static void Main() {
SendInfo.f_WriteInfo(
new[] {
new AInfo(){ ... },
new BInfo(){ ... },
} );
// This will generate an error.
// There will be need casting between new and [] like new Info[]
}
}
キャストせずにこれを行う方法はありますか?
お気に入り:
class SendInfo {
static public f_WriteInfo(params T _info) where T : Info {