本文整理汇总了C#中ITypeDefOrRef类的典型用法代码示例。如果您正苦于以下问题:C# ITypeDefOrRef类的具体用法?C# ITypeDefOrRef怎么用?C# ITypeDefOrRef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITypeDefOrRef类属于命名空间,在下文中一共展示了ITypeDefOrRef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BaseTypeNodeImpl
public BaseTypeNodeImpl(ITreeNodeGroup treeNodeGroup, ITypeDefOrRef typeDefOrRef, bool isBaseType) {
TreeNodeGroup = treeNodeGroup;
this.isBaseType = isBaseType;
// Keep weak refs to them so we won't prevent removed modules from being GC'd.
weakRefTypeDefOrRef = new WeakReference(typeDefOrRef);
weakRefResolvedTypeDef = new WeakReference(null);
}
示例2: IsGenericParam
bool IsGenericParam(ITypeDefOrRef tdr) {
var ts = tdr as TypeSpec;
if (ts == null)
return false;
var sig = ts.TypeSig.RemovePinnedAndModifiers();
return sig is GenericSig;
}
示例3: TypeDefOrRefSignature
public TypeDefOrRefSignature(ITypeDefOrRef type, bool isValueType)
{
if (type == null)
throw new ArgumentNullException("type");
Type = type;
IsValueType = isValueType;
}
示例4: Create
public static EventDefOptions Create(UTF8String name, ITypeDefOrRef eventType) {
return new EventDefOptions {
Attributes = 0,
Name = name,
EventType = eventType,
};
}
示例5: getTypeInstance
TypeInstanceResolver getTypeInstance(ITypeDefOrRef typeRef)
{
TypeInstanceResolver instance;
if (!typeRefToInstance.TryGetValue(typeRef, out instance))
typeRefToInstance[typeRef] = instance = new TypeInstanceResolver(type, typeRef);
return instance;
}
示例6: IsReferencedBy
static bool IsReferencedBy(TypeDef type, ITypeDefOrRef typeRef, int depth) {
if (depth >= 30)
return false;
// TODO: move it to a better place after adding support for more cases.
if (type == null)
return false;
if (typeRef == null)
return false;
if (type == typeRef)
return true;
if (type.Name != typeRef.Name)
return false;
if (type.Namespace != typeRef.Namespace)
return false;
if (type.DeclaringType != null || typeRef.DeclaringType != null) {
if (type.DeclaringType == null || typeRef.DeclaringType == null)
return false;
if (!IsReferencedBy(type.DeclaringType, typeRef.DeclaringType, depth + 1))
return false;
}
return true;
}
示例7: GenericInstanceTypeSignature
public GenericInstanceTypeSignature(ITypeDefOrRef genericType)
{
if (genericType == null)
throw new ArgumentNullException("genericType");
GenericType = genericType;
GenericArguments = new List<TypeSignature>();
}
示例8: AddInitializeArrayCode
public void AddInitializeArrayCode(Block block, int start, int numToRemove, ITypeDefOrRef elementType, byte[] data) {
int index = start;
block.Replace(index++, numToRemove, Instruction.CreateLdcI4(data.Length / elementType.ToTypeSig().ElementType.GetPrimitiveSize()));
block.Insert(index++, OpCodes.Newarr.ToInstruction(elementType));
block.Insert(index++, OpCodes.Dup.ToInstruction());
block.Insert(index++, OpCodes.Ldtoken.ToInstruction((IField)Create(data)));
block.Insert(index++, OpCodes.Call.ToInstruction((IMethod)InitializeArrayMethod));
}
示例9: BaseTypesEntryNode
public BaseTypesEntryNode(ITypeDefOrRef tr, bool isInterface) {
if (tr == null)
throw new ArgumentNullException("tr");
this.tr = tr;
this.def = tr.ResolveTypeDef();
this.isInterface = isInterface;
this.LazyLoading = true;
}
示例10: Create
public static ITypeDefOrRef Create(ITypeDefOrRef type, IList<TypeSig> genericArgs) {
if (genericArgs == null || genericArgs.Count == 0)
return type;
var ts = type as TypeSpec;
if (ts == null)
return type;
var newSig = Create(ts.TypeSig, genericArgs);
return newSig == ts.TypeSig ? type : new TypeSpecUser(newSig);
}
示例11: GetNonGenericTypeRef
static ITypeDefOrRef GetNonGenericTypeRef(ITypeDefOrRef typeRef) {
var ts = typeRef as TypeSpec;
if (ts == null)
return typeRef;
var gis = ts.TryGetGenericInstSig();
if (gis == null || gis.GenericType == null)
return typeRef;
return gis.GenericType.TypeDefOrRef;
}
示例12: Create
public static TypeDefOptions Create(UTF8String ns, UTF8String name, ITypeDefOrRef baseType, bool isNestedType) {
return new TypeDefOptions {
Attributes = (isNestedType ? TypeAttributes.NestedPublic : TypeAttributes.Public) | TypeAttributes.AutoLayout | TypeAttributes.Class | TypeAttributes.AnsiClass,
Namespace = ns ?? UTF8String.Empty,
Name = name ?? UTF8String.Empty,
PackingSize = null,
ClassSize = null,
BaseType = baseType,
};
}
示例13: IsMarkupExtensions
static bool IsMarkupExtensions(ITypeDefOrRef def)
{
while (def != null)
{
if (def.Namespace == "OmniXaml" && def.Name.String == "MarkupExtension")
return true;
def = def.GetBaseType();
}
return false;
}
示例14: resolve
public Type resolve(ITypeDefOrRef typeRef)
{
var resolver = getTypeResolver(typeRef);
if (resolver != null)
return resolver.type;
var ts = typeRef as TypeSpec;
if (ts != null && ts.TypeSig is GenericSig)
return typeof(MGenericParameter);
return null;
}
示例15: Compare
static bool Compare(ITypeDefOrRef type, UTF8String expNs, UTF8String expName) {
if (type == null)
return false;
var tr = type as TypeRef;
if (tr != null)
return tr.Namespace == expNs && tr.Name == expName;
var td = type as TypeDef;
if (td != null)
return td.Namespace == expNs && td.Name == expName;
return false;
}