デザインモードの判別方法。

デザインモード時は devenv.exe から呼び出される

アセンブリで判断。true でデザイン。(8.58)

Assembly.GetCallingAssembly().GetType(this.GetType().ToString()) == null

false でデザイン。(5.02 * 100)

Assembly.GetCallingAssembly().GetTypes()[0].Equals(typeof(System.Object))


またはドメイン。true でデザイン。(0.269)

AppDomain.CurrentDomain.FriendlyName != this.GetType().ToString();

true でデザイン。(0.211)

AppDomain.CurrentDomain.FriendlyName == "DefaultDomain";

()内はコスト。