本文整理汇总了C#中TypeRef类的典型用法代码示例。如果您正苦于以下问题:C# TypeRef类的具体用法?C# TypeRef怎么用?C# TypeRef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TypeRef类属于命名空间,在下文中一共展示了TypeRef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidateTypeRef
public void ValidateTypeRef(Element element, TypeRef typeref)
{
// Test if the Surrect was able to link to the target structure.
if (typeref.Structure != null)
{
Log(Group.Reference, Status.Valid, "Type reference to structure [{0}] is valid", typeref.Code);
// Genest structuren valideren hoeft niet. Want alle structures worden al op hoofdniveau gevalideerd
//ValidateStructure(typeref.Structure);
}
// Test if there is a reference at all
else if (typeref.Code == null)
{
Log(Group.Reference, Status.Failed, "Missing a reference to a structure in element [{0}]", element.Name);
}
// Test if code is itself valid? If so, the reference valid but the target is missing.
else if (Regex.IsMatch(typeref.Code, "[A-Za-z][A-Za-z0-9]*"))
{
// Collect first to avoid duplicates
missingStructureNames.Add(typeref.Code);
}
// The code contains invalid characters
else
{
Log(Group.Reference, Status.Failed, "Invalid structure reference '{0}' in {1}", typeref.Code, element.Path);
}
}
示例2: ResolvingUri
/*
public static Uri ResolvingUri(TypeRef typeref)
{
if (typeref.ProfileUri == null)
{
return BaseProfileUriFor(typeref.Code);
}
else
{
return new Uri(typeref.ProfileUri);
}
}
*/
public static Uri Identify(Structure structure, TypeRef typeref)
{
string name = typeref.Code;
Uri uri;
if ((name == "ResourceReference"))
{
uri = BaseProfileUriFor(name);
}
else if (typeref.ProfileUri != null)
{
if (typeref.ProfileUri.StartsWith("#"))
{
uri = new Uri(structure.ProfileUri + typeref.ProfileUri);
}
else if (typeref.ProfileUri != null)
{
uri = new Uri(typeref.ProfileUri);
}
else
{
uri = BaseProfileUriFor(name);
}
}
else // typeref.profileuri == null
{
uri = BaseProfileUriFor(name);
}
return uri;
}
示例3: ExtensionPointInfo
/// <summary>
/// Internal constructor.
/// </summary>
internal ExtensionPointInfo(TypeRef extensionPointClass, TypeRef extensionInterface, string name, string description)
{
_extensionPointClass = extensionPointClass;
_extensionInterface = extensionInterface;
_name = name;
_description = description;
}
示例4: Resolve
/// <inheritdoc/>
public TypeDef Resolve(TypeRef typeRef) {
if (typeRef == null)
return null;
var nonNestedTypeRef = TypeRef.GetNonNestedTypeRef(typeRef);
if (nonNestedTypeRef == null)
return null;
var asmRef = nonNestedTypeRef.ResolutionScope as AssemblyRef;
if (asmRef != null) {
var asm = assemblyResolver.Resolve(asmRef, nonNestedTypeRef.Module);
return asm == null ? null : asm.Find(typeRef);
}
var moduleDef = nonNestedTypeRef.ResolutionScope as ModuleDef;
if (moduleDef != null)
return moduleDef.Find(typeRef);
var moduleRef = nonNestedTypeRef.ResolutionScope as ModuleRef;
if (moduleRef != null) {
if (nonNestedTypeRef.Module == null)
return null;
if (new SigComparer().Equals(moduleRef, nonNestedTypeRef.Module))
return nonNestedTypeRef.Module.Find(typeRef);
if (nonNestedTypeRef.Module.Assembly == null)
return null;
var resolvedModule = nonNestedTypeRef.Module.Assembly.FindModule(moduleRef.Name);
return resolvedModule == null ? null : resolvedModule.Find(typeRef);
}
return null;
}
示例5: EmittedParameter
internal EmittedParameter(int index, string name, TypeRef type)
{
this.Index = index;
this.Name = name;
this.ParameterType = type;
this.Attributes = ParameterAttributes.None;
}
示例6: EmittedProperty
public EmittedProperty(EmittedClass type, string name, TypeRef propertyType, bool isStatic)
: base(type, name)
{
Contracts.Require.IsNotNull("propertyType", propertyType);
this.PropertyType = propertyType;
this._isStatic = isStatic;
}
示例7: ExtensionInfo
public ExtensionInfo(TypeRef extensionClass, TypeRef pointExtended, string name, string description, bool enabled, string featureToken)
{
_extensionClass = extensionClass;
_pointExtended = pointExtended;
_name = name;
_description = description;
_enabled = enabled;
_featureToken = featureToken;
}
示例8: EmittedField
public EmittedField(EmittedClass type, string name, TypeRef fieldType)
: base(type, name)
{
Contracts.Require.IsNotNull("type", type);
Contracts.Require.IsNotNull("name", name);
this.FieldType = fieldType;
this.Attributes = FieldAttributes.Private;
}
示例9: TypeDefOrRefRowFromTypeRef
// ----------------------------------------------------------------------
// Type references
// ----------------------------------------------------------------------
private PE.Row TypeDefOrRefRowFromTypeRef(DllSaveContext ctxt, TypeRef typeRef)
{
var row = default(PE.Row);
if (!ctxt.TypeRefToRowCache.TryGetValue(typeRef, out row))
{
if (typeRef.Arguments.Count == 0)
row = TypeDefOrRefRowFromQualifiedTypeName(ctxt, typeRef.QualifiedTypeName);
else
row = new PE.TypeSpecRow { Signature = { Value = TypeSigFromTypeRef(ctxt, typeRef) } };
ctxt.TypeRefToRowCache.Add(typeRef, row);
}
return row;
}
示例10: AddExtensionElement
public static void AddExtensionElement(Structure structure, Element parent = null)
{
parent = parent ?? structure.Root;
string path = string.Format("{0}.extension", parent.Path);
Element element = new Element();
element.Path = new Path(path);
element.Name = "extension";
element.Cardinality = new Cardinality { Min = "0", Max = "*" };
TypeRef typeref = new TypeRef("Extension");
UriHelper.SetTypeRefIdentification(structure, typeref);
element.TypeRefs.Add(typeref);
structure.Elements.Add(element);
}
示例11: Unify
public void Unify(RootEnvironment rootEnv, StackEntryState other, BoolRef changed)
{
var type = Type.Lub(rootEnv, other.Type, changed);
var upperBound = default(TypeRef);
if (UpperBound != null && other.UpperBound != null)
upperBound = UpperBound.Glb(rootEnv, other.UpperBound, changed);
else if (other.UpperBound != null)
{
upperBound = other.UpperBound;
changed.Set();
}
else
upperBound = UpperBound;
if (upperBound != null && !type.IsAssignableTo(rootEnv, upperBound))
throw new InvalidOperationException("stack entries are not unifiable");
var pointsTo = PointsTo.Lub(other.PointsTo, changed);
UpperBound = upperBound;
Type = type;
PointsTo = pointsTo;
}
示例12: ConstInt
public unsafe static ValueRef ConstInt(TypeRef IntTy, ulong N, bool SignExtend) {
ValueRef ret = new ValueRef(LLVMPINVOKE.ConstInt(IntTy.Value, N, SignExtend));
return ret;
}
示例13: ConstPointerNull
public unsafe static ValueRef ConstPointerNull(TypeRef Ty) {
ValueRef ret = new ValueRef(LLVMPINVOKE.ConstPointerNull(Ty.Value));
return ret;
}
示例14: GetUndef
public unsafe static ValueRef GetUndef(TypeRef Ty) {
ValueRef ret = new ValueRef(LLVMPINVOKE.GetUndef(Ty.Value));
return ret;
}
示例15: ConstAllOnes
public unsafe static ValueRef ConstAllOnes(TypeRef Ty) {
ValueRef ret = new ValueRef(LLVMPINVOKE.ConstAllOnes(Ty.Value));
return ret;
}