本文整理汇总了C#中MosaType.GetTypeSig方法的典型用法代码示例。如果您正苦于以下问题:C# MosaType.GetTypeSig方法的具体用法?C# MosaType.GetTypeSig怎么用?C# MosaType.GetTypeSig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MosaType
的用法示例。
在下文中一共展示了MosaType.GetTypeSig方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResolveType
private void ResolveType(MosaType type)
{
GenericArgumentResolver resolver = new GenericArgumentResolver();
MosaType srcType = type;
if (type.GenericArguments.Count > 0)
{
resolver.PushTypeGenericArguments(type.GenericArguments.GetGenericArguments());
srcType = type.ElementType;
Debug.Assert(srcType != null);
}
using (var mosaType = metadata.Controller.MutateType(type))
{
if (srcType.BaseType != null)
mosaType.BaseType = metadata.Loader.GetType(resolver.Resolve(srcType.BaseType.GetTypeSig()));
if (srcType.DeclaringType != null)
{
mosaType.DeclaringType = metadata.Loader.GetType(resolver.Resolve(srcType.DeclaringType.GetTypeSig()));
mosaType.Namespace = srcType.DeclaringType.Namespace;
}
var ifaces = new List<MosaType>(srcType.Interfaces);
mosaType.Interfaces.Clear();
for (int i = 0; i < ifaces.Count; i++)
mosaType.Interfaces.Add(metadata.Loader.GetType(resolver.Resolve(ifaces[i].GetTypeSig())));
mosaType.HasOpenGenericParams = type.GetTypeSig().HasOpenGenericParameter();
ResolveCustomAttributes(mosaType, srcType.GetUnderlyingObject<UnitDesc<TypeDef, TypeSig>>().Definition);
}
// Add type again to make it easier to find
metadata.Controller.AddType(type);
}
示例2: ResolveType
private void ResolveType(MosaType type)
{
GenericArgumentResolver resolver = new GenericArgumentResolver();
if (type.GenericArguments.Count > 0)
resolver.PushTypeGenericArguments(type.GenericArguments.GetGenericArguments());
using (var mosaType = metadata.Controller.MutateType(type))
{
if (type.BaseType != null)
mosaType.BaseType = metadata.Loader.GetType(resolver.Resolve(type.BaseType.GetTypeSig()));
if (type.DeclaringType != null)
mosaType.DeclaringType = metadata.Loader.GetType(resolver.Resolve(type.DeclaringType.GetTypeSig()));
for (int i = 0; i < type.Interfaces.Count; i++)
mosaType.Interfaces[i] = metadata.Loader.GetType(resolver.Resolve(type.Interfaces[i].GetTypeSig()));
mosaType.HasOpenGenericParams = type.GetTypeSig().HasOpenGenericParameter();
ResolveCustomAttributes(mosaType, type.GetUnderlyingObject<UnitDesc<TypeDef, TypeSig>>().Definition);
}
}