6
の既定のインスタンスを作成します。私は、例えば、実行時までのタイプを持っていない場合はの反射同等であるどのようなタイプ
default(object); //null
は、
public void Method(Type type)
{
var instance = type.CreateDefault(); //no such method exists, but I expect there is a way of doing this?
}
いいえ、私はこのケースではnullに満足しています。だから、私はActivatorを値の型に、そうでなければnullを使用します。ありがとうジョン。 –