本文整理汇总了C#中IAssembly.IsCorLib方法的典型用法代码示例。如果您正苦于以下问题:C# IAssembly.IsCorLib方法的具体用法?C# IAssembly.IsCorLib怎么用?C# IAssembly.IsCorLib使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAssembly
的用法示例。
在下文中一共展示了IAssembly.IsCorLib方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCorLibTypeSig
/// <summary>
/// Gets a <see cref="CorLibTypeSig"/> if <paramref name="namespace"/> and
/// <paramref name="name"/> matches a primitive type.
/// </summary>
/// <param name="self">this</param>
/// <param name="namespace">Namespace</param>
/// <param name="name">Name</param>
/// <param name="defAsm">Definition assembly</param>
/// <returns>A <see cref="CorLibTypeSig"/> or <c>null</c> if it didn't match any primitive type</returns>
public static CorLibTypeSig GetCorLibTypeSig(this ICorLibTypes self, string @namespace, string name, IAssembly defAsm) {
if (@namespace != "System")
return null;
if (defAsm == null || !defAsm.IsCorLib())
return null;
switch (name) {
case "Void": return self.Void;
case "Boolean": return self.Boolean;
case "Char": return self.Char;
case "SByte": return self.SByte;
case "Byte": return self.Byte;
case "Int16": return self.Int16;
case "UInt16": return self.UInt16;
case "Int32": return self.Int32;
case "UInt32": return self.UInt32;
case "Int64": return self.Int64;
case "UInt64": return self.UInt64;
case "Single": return self.Single;
case "Double": return self.Double;
case "String": return self.String;
case "TypedReference": return self.TypedReference;
case "IntPtr": return self.IntPtr;
case "UIntPtr": return self.UIntPtr;
case "Object": return self.Object;
}
return null;
}