当 Combox的SelectIndex设置的值超出子项后,index会自动切换成默认值-1,并不会抛出异常.
TextBox的Text默认值是空字符串不是null。
Assembly.GetCallingAssembly()和Assembly.GetExecutingAssembly()的区别。后者是指写这行代码的程序集,也就是当前程序集,值是固定的唯一的。前者是指引用这行代码所在的程序集,调用这行代码所属的类,方法的程序集,值可能是自身程序集,也可能是其他程序集,可能值理论上无限个。
// Assembly FirstAssembly
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
namespace FirstAssembly
{
public class InFirstAssembly
{
public static void Main()
{
FirstMethod();
SecondAssembly.InSecondAssembly.OtherMethod();
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static void FirstMethod()
{
Console.WriteLine("FirstMethod called from: " + Assembly.GetCallingAssembly().FullName);
}
}
}
// Assembly SecondAssembly
namespace SecondAssembly
{
class InSecondAssembly
{
[MethodImpl(MethodImplOptions.NoInlining)]
public static void OtherMethod()
{
Console.WriteLine("OtherMethod executing assembly: " + Assembly.GetExecutingAssembly().FullName);
Console.WriteLine("OtherMethod called from: " + Assembly.GetCallingAssembly().FullName);
}
}
}
// The example produces output like the following:
// "FirstMethod called from: FirstAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"
// "OtherMethod executing assembly: SecondAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"
// "OtherMethod called from: FirstAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"
标签:Assembly,0.0,OtherMethod,called,NET,null,杂项,FirstAssembly From: https://www.cnblogs.com/LiuwayLi/p/16969505.html