本文整理汇总了C#中INameTable.GetNameFor方法的典型用法代码示例。如果您正苦于以下问题:C# INameTable.GetNameFor方法的具体用法?C# INameTable.GetNameFor怎么用?C# INameTable.GetNameFor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类INameTable
的用法示例。
在下文中一共展示了INameTable.GetNameFor方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
public static AssemblyIdentity Parse(INameTable nameTable, string formattedName)
{
var name = new System.Reflection.AssemblyName(formattedName);
return new AssemblyIdentity(nameTable.GetNameFor(name.Name),
name.CultureName,
name.Version,
name.GetPublicKeyToken(),
#if COREFX
"");
#else
name.CodeBase);
#endif
}
示例2: TypeNameParser
internal TypeNameParser(
INameTable nameTable,
string typeName
) {
this.NameTable = nameTable;
this.TypeName = typeName;
this.Length = typeName.Length;
this.Version = nameTable.GetNameFor("Version");
this.Retargetable = nameTable.GetNameFor("Retargetable");
this.PublicKeyToken = nameTable.GetNameFor("PublicKeyToken");
this.Culture = nameTable.GetNameFor("Culture");
this.neutral = nameTable.GetNameFor("neutral");
this.CurrentIdentifierInfo = nameTable.EmptyName;
this.NextToken(false);
}
示例3: NestedTypeName
internal NestedTypeName(INameTable nameTable, NominalTypeName containingTypeName, IName mangledName) {
this.ContainingTypeName = containingTypeName;
this.Name = mangledName;
string nameStr = null;
TypeCache.SplitMangledTypeName(mangledName.Value, out nameStr, out this.genericParameterCount);
this.unmangledTypeName = nameTable.GetNameFor(nameStr);
}
示例4: NamespaceTypeName
internal NamespaceTypeName(INameTable nameTable, NamespaceName/*?*/ namespaceName, IName name) {
this.NamespaceName = namespaceName;
this.Name = name;
string nameStr = null;
TypeCache.SplitMangledTypeName(name.Value, out nameStr, out this.genericParameterCount);
if (this.genericParameterCount > 0)
this.unmanagledTypeName = nameTable.GetNameFor(nameStr);
else
this.unmanagledTypeName = name;
}
示例5: NamespaceName
internal NamespaceName(INameTable nameTable, NamespaceName/*?*/ parentNamespaceName, IName name) {
this.ParentNamespaceName = parentNamespaceName;
this.Name = name;
if (parentNamespaceName == null)
this.FullyQualifiedName = name;
else
this.FullyQualifiedName = nameTable.GetNameFor(parentNamespaceName.FullyQualifiedName.Value + "." + name);
}
示例6: WindowsRuntimeMetadataReaderHost
/// <summary>
/// A base class for an object provided by the application hosting the metadata reader. The object allows the host application
/// to control how assembly references are unified, where files are found, how Windows Runtime types and methods are projected to CLR types and methods
/// and so on. The object also controls the lifetime of things such as memory mapped files and blocks of unmanaged memory. Be sure to call Dispose on the object when
/// it is no longer needed and the associated locks and/or memory must be released immediately.
/// </summary>
/// <param name="nameTable">
/// A collection of IName instances that represent names that are commonly used during compilation.
/// This is a provided as a parameter to the host environment in order to allow more than one host
/// environment to co-exist while agreeing on how to map strings to IName instances.
/// </param>
/// <param name="factory">
/// The intern factory to use when generating keys. When comparing two or more assemblies using
/// TypeHelper, MemberHelper, etc. it is necessary to make the hosts use the same intern factory.
/// </param>
/// <param name="pointerSize">The size of a pointer on the runtime that is the target of the metadata units to be loaded
/// into this metadta host. This parameter only matters if the host application wants to work out what the exact layout
/// of a struct will be on the target runtime. The framework uses this value in methods such as TypeHelper.SizeOfType and
/// TypeHelper.TypeAlignment. If the host application does not care about the pointer size it can provide 0 as the value
/// of this parameter. In that case, the first reference to IMetadataHost.PointerSize will probe the list of loaded assemblies
/// to find an assembly that either requires 32 bit pointers or 64 bit pointers. If no such assembly is found, the default is 32 bit pointers.
/// </param>
/// <param name="searchPaths">
/// A collection of strings that are interpreted as valid paths which are used to search for units.
/// </param>
/// <param name="searchInGAC">
/// Whether the GAC (Global Assembly Cache) should be searched when resolving references.
/// </param>
/// <param name="projectToCLRTypes">True if the host should project references to certain Windows Runtime types and methods
/// to corresponding CLR types and methods, in order to emulate the runtime behavior of the CLR.</param>
protected WindowsRuntimeMetadataReaderHost(INameTable nameTable, IInternFactory factory, byte pointerSize, IEnumerable<string> searchPaths,
bool searchInGAC, bool projectToCLRTypes)
: base(nameTable, factory, pointerSize, searchPaths, searchInGAC) {
Contract.Requires(pointerSize == 0 || pointerSize == 4 || pointerSize == 8);
this.projectToCLRTypes = projectToCLRTypes;
this.AllowMultiple = nameTable.GetNameFor("AllowMultiple");
this.AllowMultipleAttribute = nameTable.GetNameFor("AllowMultipleAttribute");
this.Animation = nameTable.GetNameFor("Animation");
this.Collections = nameTable.GetNameFor("Collections");
this.Controls = nameTable.GetNameFor("Controls");
this.Data = nameTable.GetNameFor("Data");
this.Foundation = nameTable.GetNameFor("Foundation");
this.HResult = nameTable.GetNameFor("HResult");
this.IBindableIterable = nameTable.GetNameFor("IBindableIterable");
this.IBindableVector = nameTable.GetNameFor("IBindableVector");
this.IClosable = nameTable.GetNameFor("IClosable");
this.IIterable = nameTable.GetNameFor("IIterable");
this.IKeyValuePair = nameTable.GetNameFor("IKeyValuePair");
this.IMap = nameTable.GetNameFor("IMap");
this.IMapView = nameTable.GetNameFor("IMapView");
this.INotifyCollectionChanged = nameTable.GetNameFor("INotifyCollectionChanged");
this.INotifyPropertyChanged = nameTable.GetNameFor("INotifyPropertyChanged");
this.Input = nameTable.GetNameFor("Input");
this.Interop = nameTable.GetNameFor("Interop");
this.IReference = nameTable.GetNameFor("IReference");
this.IVector = nameTable.GetNameFor("IVector");
this.IVectorView = nameTable.GetNameFor("IVectorView");
this.Media = nameTable.GetNameFor("Media");
this.Media3D = nameTable.GetNameFor("Media3D");
this.Metadata = nameTable.GetNameFor("Metadata");
this.NotifyCollectionChangedAction = nameTable.GetNameFor("NotifyCollectionChangedAction");
this.NotifyCollectionChangedEventArgs = nameTable.GetNameFor("NotifyCollectionChangedEventArgs");
this.NotifyCollectionChangedEventHandler = nameTable.GetNameFor("NotifyCollectionChangedEventHandler");
this.Primitives = nameTable.GetNameFor("Primitives");
this.PropertyChangedEventArgs = nameTable.GetNameFor("PropertyChangedEventArgs");
this.PropertyChangedEventHandler = nameTable.GetNameFor("PropertyChangedEventHandler");
this.TypeName = nameTable.GetNameFor("TypeName");
this.UI = nameTable.GetNameFor("UI");
this.Windows = nameTable.GetNameFor("Windows");
this.Xaml = nameTable.GetNameFor("Xaml");
}
示例7: FirstStatementIsIteratorCreation
private static IMethodBody/*?*/ FirstStatementIsIteratorCreation(IMetadataHost host, ISourceMethodBody possibleIterator, INameTable nameTable, IStatement statement) {
ICreateObjectInstance createObjectInstance = GetICreateObjectInstance(statement);
if (createObjectInstance == null) {
// If the first statement in the method body is not the creation of iterator closure, return a dummy.
// Possible corner case not handled: a local is used to hold the constant value for the initial state of the closure.
return null;
}
ITypeReference closureType/*?*/ = createObjectInstance.MethodToCall.ContainingType;
ITypeReference unspecializedClosureType = ContractHelper.Unspecialized(closureType);
if (!AttributeHelper.Contains(unspecializedClosureType.Attributes, host.PlatformType.SystemRuntimeCompilerServicesCompilerGeneratedAttribute))
return null;
INestedTypeReference closureTypeAsNestedTypeReference = unspecializedClosureType as INestedTypeReference;
if (closureTypeAsNestedTypeReference == null) return null;
ITypeReference unspecializedClosureContainingType = ContractHelper.Unspecialized(closureTypeAsNestedTypeReference.ContainingType);
if (closureType != null && TypeHelper.TypesAreEquivalent(possibleIterator.MethodDefinition.ContainingTypeDefinition, unspecializedClosureContainingType)) {
IName MoveNextName = nameTable.GetNameFor("MoveNext");
foreach (ITypeDefinitionMember member in closureType.ResolvedType.GetMembersNamed(MoveNextName, false)) {
IMethodDefinition moveNext = member as IMethodDefinition;
if (moveNext != null) {
ISpecializedMethodDefinition moveNextGeneric = moveNext as ISpecializedMethodDefinition;
if (moveNextGeneric != null)
moveNext = moveNextGeneric.UnspecializedVersion.ResolvedMethod;
return moveNext.Body;
}
}
}
return null;
}