本文整理汇总了C#中TypeFlags类的典型用法代码示例。如果您正苦于以下问题:C# TypeFlags类的具体用法?C# TypeFlags怎么用?C# TypeFlags使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TypeFlags类属于命名空间,在下文中一共展示了TypeFlags类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public void Init(string fullName, int flags, JsTypeFunction thisType, JsTypeFunction baseType, JsTypeFunction[] interfaces, JsTypeFunction[] typeArguments, FieldInfo[] fields, MethodInfo[] methods, ConstructorInfo[] constructors, PropertyInfo[] properties, EventInfo[] events, JsTypeFunction elementType, JsTypeFunction unconstructedType)
{
FullName = fullName;
typeFlags = (TypeFlags)flags;
// this.typeAttributes = typeAttributes;
this.thisType = thisType;
this.baseType = baseType;
this.interfaces = interfaces;
this.typeArguments = typeArguments;
this.fields = fields ?? new FieldInfo[0];
this.methods = methods ?? new MethodInfo[0];
this.properties = properties ?? new PropertyInfo[0];
this.constructors = constructors ?? new ConstructorInfo[0];
this.events = events ?? new EventInfo[0];
this.elementType = elementType;
this.unconstructedType = unconstructedType;
foreach (var field in this.fields)
field.declaringType = this;
foreach (var method in this.methods)
method.declaringType = this;
foreach (var property in this.properties)
{
property.declaringType = this;
if (property.GetMethod != null)
property.GetMethod.declaringType = this;
if (property.SetMethod != null)
property.SetMethod.declaringType = this;
}
foreach (var constructor in this.constructors)
constructor.declaringType = this;
}
示例2: GetDefaultMapping
internal TypeMapping GetDefaultMapping(TypeFlags flags) {
PrimitiveMapping mapping = new PrimitiveMapping();
mapping.TypeDesc = Scope.GetTypeDesc("string", XmlSchema.Namespace, flags);
mapping.TypeName = mapping.TypeDesc.DataType.Name;
mapping.Namespace = XmlSchema.Namespace;
return mapping;
}
示例3: TypeDesc
internal TypeDesc(string name, string fullName, XmlSchemaType dataType, TypeKind kind, TypeDesc baseTypeDesc, TypeFlags flags, string formatterName)
{
this.name = name.Replace('+', '.');
this.fullName = fullName.Replace('+', '.');
this.kind = kind;
this.baseTypeDesc = baseTypeDesc;
this.flags = flags;
this.isXsdType = kind == TypeKind.Primitive;
if (this.isXsdType)
{
this.weight = 1;
}
else if (kind == TypeKind.Enum)
{
this.weight = 2;
}
else if (this.kind == TypeKind.Root)
{
this.weight = -1;
}
else
{
this.weight = (baseTypeDesc == null) ? 0 : (baseTypeDesc.Weight + 1);
}
this.dataType = dataType;
this.formatterName = formatterName;
}
示例4: ComputeTypeFlags
protected override TypeFlags ComputeTypeFlags(TypeFlags mask)
{
// We might be able to compute the type flags for some masks, but for some this will always throw (e.g.
// Category and GenericVariance should always throw). If you hit an exception, it means you need a
// special case for IsSignatureVariable.
throw new NotImplementedException();
}
示例5: ComputeTypeFlags
protected override TypeFlags ComputeTypeFlags(TypeFlags mask)
{
return TypeFlags.Class |
TypeFlags.ContainsGenericVariablesComputed |
TypeFlags.HasGenericVarianceComputed |
TypeFlags.HasStaticConstructorComputed;
}
示例6: ComputeTypeFlags
protected override TypeFlags ComputeTypeFlags(TypeFlags mask)
{
TypeFlags flags = TypeFlags.FunctionPointer;
if ((mask & TypeFlags.ContainsGenericVariablesComputed) != 0)
{
flags |= TypeFlags.ContainsGenericVariablesComputed;
if (_signature.ReturnType.ContainsGenericVariables)
flags |= TypeFlags.ContainsGenericVariables;
else
{
for (int i = 0; i < _signature.Length; i++)
{
if (_signature[i].ContainsGenericVariables)
{
flags |= TypeFlags.ContainsGenericVariables;
break;
}
}
}
}
flags |= TypeFlags.HasGenericVarianceComputed;
return flags;
}
示例7: CheckNeedConstructor
internal void CheckNeedConstructor()
{
if ((!this.IsValueType && !this.IsAbstract) && !this.HasDefaultConstructor)
{
this.flags |= TypeFlags.Unsupported;
this.exception = new InvalidOperationException(Res.GetString("XmlConstructorInaccessible", new object[] { this.FullName }));
}
}
示例8: TypeDesc
public TypeDesc(string name, string fullName, TypeKind kind, TypeDesc baseTypeDesc, TypeFlags flags) {
this.name = name.Replace('+', '.');
this.fullName = fullName.Replace('+', '.');
this.kind = kind;
if (baseTypeDesc != null) {
this.baseTypeDesc = baseTypeDesc;
}
this.flags = flags;
this.isXsdType = kind == TypeKind.Primitive;
}
示例9: ComputeTypeFlags
protected override TypeFlags ComputeTypeFlags(TypeFlags mask)
{
TypeFlags flags = 0;
flags |= TypeFlags.ContainsGenericVariablesComputed | TypeFlags.ContainsGenericVariables;
flags |= TypeFlags.GenericParameter;
return flags;
}
示例10: ComputeTypeFlags
protected override TypeFlags ComputeTypeFlags(TypeFlags mask)
{
TypeFlags flags = 0;
if ((mask & TypeFlags.CategoryMask) != 0)
{
flags |= TypeFlags.SignatureTypeVariable;
}
return flags;
}
示例11: AddPrimitive
private static void AddPrimitive(Type type, string dataTypeName, string formatterName, TypeFlags flags)
{
XmlSchemaSimpleType dataType = new XmlSchemaSimpleType {
Name = dataTypeName
};
TypeDesc desc = new TypeDesc(type, true, dataType, formatterName, flags);
if (primitiveTypes[type] == null)
{
primitiveTypes.Add(type, desc);
}
primitiveDataTypes.Add(dataType, desc);
primitiveNames.Add(dataTypeName, "http://www.w3.org/2001/XMLSchema", desc);
}
示例12: ComputeTypeFlags
protected override TypeFlags ComputeTypeFlags(TypeFlags mask)
{
TypeFlags flags = 0;
flags |= TypeFlags.ContainsGenericVariablesComputed | TypeFlags.ContainsGenericVariables;
flags |= TypeFlags.GenericParameter;
flags |= TypeFlags.HasGenericVarianceComputed;
Debug.Assert((flags & mask) != 0);
return flags;
}
示例13: ComputeTypeFlags
protected override TypeFlags ComputeTypeFlags(TypeFlags mask)
{
TypeFlags flags = TypeFlags.ByRef;
if ((mask & TypeFlags.ContainsGenericVariablesComputed) != 0)
{
flags |= TypeFlags.ContainsGenericVariablesComputed;
if (this.ParameterType.ContainsGenericVariables)
flags |= TypeFlags.ContainsGenericVariables;
}
return flags;
}
示例14: ComputeTypeFlags
protected override TypeFlags ComputeTypeFlags(TypeFlags mask)
{
TypeFlags flags = 0;
if ((mask & TypeFlags.CategoryMask) != 0)
{
flags |= TypeFlags.SignatureTypeVariable;
}
// Not all masks are valid to ask on signature variables. If you hit this assert, you might
// need to special case, or you have a bug.
Debug.Assert((flags & mask) != 0);
return flags;
}
示例15: AddNonXsdPrimitive
private static void AddNonXsdPrimitive(Type type, string dataTypeName, string ns, string formatterName, XmlQualifiedName baseTypeName, XmlSchemaFacet[] facets, TypeFlags flags)
{
XmlSchemaSimpleType dataType = new XmlSchemaSimpleType {
Name = dataTypeName
};
XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction {
BaseTypeName = baseTypeName
};
foreach (XmlSchemaFacet facet in facets)
{
restriction.Facets.Add(facet);
}
dataType.Content = restriction;
TypeDesc desc = new TypeDesc(type, false, dataType, formatterName, flags);
if (primitiveTypes[type] == null)
{
primitiveTypes.Add(type, desc);
}
primitiveDataTypes.Add(dataType, desc);
primitiveNames.Add(dataTypeName, ns, desc);
}