本文整理汇总了C#中TypeKind类的典型用法代码示例。如果您正苦于以下问题:C# TypeKind类的具体用法?C# TypeKind怎么用?C# TypeKind使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TypeKind类属于命名空间,在下文中一共展示了TypeKind类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CodeGenerationNamedTypeSymbol
public CodeGenerationNamedTypeSymbol(
INamedTypeSymbol containingType,
IList<AttributeData> attributes,
Accessibility declaredAccessibility,
DeclarationModifiers modifiers,
TypeKind typeKind,
string name,
IList<ITypeParameterSymbol> typeParameters,
INamedTypeSymbol baseType,
IList<INamedTypeSymbol> interfaces,
SpecialType specialType,
IList<ISymbol> members,
IList<CodeGenerationAbstractNamedTypeSymbol> typeMembers,
INamedTypeSymbol enumUnderlyingType)
: base(containingType, attributes, declaredAccessibility, modifiers, name, specialType, typeMembers)
{
_typeKind = typeKind;
_typeParameters = typeParameters ?? SpecializedCollections.EmptyList<ITypeParameterSymbol>();
_baseType = baseType;
_interfaces = interfaces ?? SpecializedCollections.EmptyList<INamedTypeSymbol>();
_members = members ?? SpecializedCollections.EmptyList<ISymbol>();
_enumUnderlyingType = enumUnderlyingType;
this.OriginalDefinition = this;
}
示例2: KindsRestriction
public KindsRestriction(TypeKind[] kinds)
{
if (kinds == null)
throw Error.ArgumentNull("kinds");
this.kinds = kinds;
}
示例3: GenerateTypeOptionsResult
public GenerateTypeOptionsResult(
Accessibility accessibility,
TypeKind typeKind,
string typeName,
Project project,
bool isNewFile,
string newFileName,
IList<string> folders,
string fullFilePath,
Document existingDocument,
bool areFoldersValidIdentifiers,
bool isCancelled = false)
{
this.Accessibility = accessibility;
this.TypeKind = typeKind;
this.TypeName = typeName;
this.Project = project;
this.IsNewFile = isNewFile;
this.NewFileName = newFileName;
this.Folders = folders;
this.FullFilePath = fullFilePath;
this.ExistingDocument = existingDocument;
this.AreFoldersValidIdentifiers = areFoldersValidIdentifiers;
this.IsCancelled = isCancelled;
}
示例4: SynthesizedContainer
internal SynthesizedContainer(MethodSymbol topLevelMethod, string name, TypeKind typeKind)
{
this.typeKind = typeKind;
this.containingSymbol = topLevelMethod.ContainingType;
this.name = name;
this.TypeMap = TypeMap.Empty.WithAlphaRename(topLevelMethod, this, out this.typeParameters);
}
示例5: MockType
public MockType(string name = "", bool? isReferenceType = false, TypeKind kind = TypeKind.Class)
{
this.name = name;
this.isReferenceType = isReferenceType;
this.kind = kind;
BaseTypes = new List<IType>();
}
示例6: SetGenerateTypeOptions
public void SetGenerateTypeOptions(
Accessibility accessibility = Accessibility.NotApplicable,
TypeKind typeKind = TypeKind.Class,
string typeName = null,
Project project = null,
bool isNewFile = false,
string newFileName = null,
IList<string> folders = null,
string fullFilePath = null,
Document existingDocument = null,
bool areFoldersValidIdentifiers = true,
string defaultNamespace = null,
bool isCancelled = false)
{
Accessibility = accessibility;
TypeKind = typeKind;
TypeName = typeName;
Project = project;
IsNewFile = isNewFile;
NewFileName = newFileName;
Folders = folders;
FullFilePath = fullFilePath;
ExistingDocument = existingDocument;
AreFoldersValidIdentifiers = areFoldersValidIdentifiers;
DefaultNamespace = defaultNamespace;
IsCancelled = isCancelled;
}
示例7: 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;
}
示例8: HasKind
private bool HasKind(TypeKind candidate)
{
foreach (var kind in kinds)
if (kind == candidate)
return true;
return false;
}
示例9: AsyncStateMachine
public AsyncStateMachine(VariableSlotAllocator variableAllocatorOpt, TypeCompilationState compilationState, MethodSymbol asyncMethod, int asyncMethodOrdinal, TypeKind typeKind)
: base(variableAllocatorOpt, compilationState, asyncMethod, asyncMethodOrdinal)
{
// TODO: report use-site errors on these types
_typeKind = typeKind;
_interfaces = ImmutableArray.Create(asyncMethod.DeclaringCompilation.GetWellKnownType(WellKnownType.System_Runtime_CompilerServices_IAsyncStateMachine));
_constructor = new AsyncConstructor(this);
}
示例10: TypeSpecifier
public TypeSpecifier(string name, TypeKind kind,
TypedNodeList typeParameters, Location location)
: base(location)
{
this.name = name;
this.kind = kind;
this.typeParameters = typeParameters;
}
示例11: AsyncStateMachine
public AsyncStateMachine(MethodSymbol asyncMethod, TypeKind typeKind)
: base(GeneratedNames.MakeStateMachineTypeName(asyncMethod.Name, SequenceNumber(asyncMethod)), asyncMethod)
{
// TODO: report use-site errors on these types
this.typeKind = typeKind;
this.asyncMethod = asyncMethod;
this.interfaces = ImmutableArray.Create(asyncMethod.DeclaringCompilation.GetWellKnownType(WellKnownType.System_Runtime_CompilerServices_IAsyncStateMachine));
this.constructor = new AsyncConstructor(this);
}
示例12: 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;
}
示例13: ToString
public static string ToString(TypeKind typeKind, object value)
{
switch (typeKind)
{
case TypeKind.String:
return (string)value;
case TypeKind.IgnoreCaseString:
return ((IgnoreCaseString)value).Value;
case TypeKind.Char:
return ((char)value).ToString();
case TypeKind.Decimal:
return ((decimal)value).ToInvString();
case TypeKind.Int64:
return ((long)value).ToInvString();
case TypeKind.Int32:
return ((int)value).ToInvString();
case TypeKind.Int16:
return ((short)value).ToInvString();
case TypeKind.SByte:
return ((sbyte)value).ToInvString();
case TypeKind.UInt64:
return ((ulong)value).ToInvString();
case TypeKind.UInt32:
return ((uint)value).ToInvString();
case TypeKind.UInt16:
return ((ushort)value).ToInvString();
case TypeKind.Byte:
return ((byte)value).ToInvString();
case TypeKind.Double:
{
bool isLiteral;
return ((double)value).ToInvString(out isLiteral);
}
case TypeKind.Single:
{
bool isLiteral;
return ((float)value).ToInvString(out isLiteral);
}
case TypeKind.Boolean:
return ((bool)value).ToInvString();
case TypeKind.Binary:
return ((Binary)value).ToBase64String();
case TypeKind.Guid:
return ((Guid)value).ToInvString();
case TypeKind.TimeSpan:
return ((TimeSpan)value).ToInvString();
case TypeKind.DateTimeOffset:
return ((DateTimeOffset)value).ToInvString();
default:
throw new ArgumentException("Invalid type kind: " + typeKind.ToString());
}
}
示例14: ModifiedType
internal ModifiedType(TypeKind kind, Type modifier, Type baseType)
: base(kind.Check(kind.IsModifiedType(), "Not a valid modified type kind", "kind"))
{
if (Kind == TypeKind.ModOpt || Kind == TypeKind.ModReq) {
m_modfier = modifier.CheckNotNull("modifier");
}
else {
m_modfier = modifier.CheckNull("modifier", "A modifier type may only be specified for ModOpt and ModReq types");
}
m_baseType = baseType.CheckNotNull("baseType");
}
示例15: ProjectionCollectionType
internal ProjectionCollectionType(TypeKind kind, Type type, ProjectionFactory factory)
: base(type, kind, factory)
{
// Must register before getting key/item types, due to possible cycles
// Example: A -> IList<B> -> B -> IList<B>
factory.RegisterProjectionType(this);
Type keyType, itemType;
GetSubtypes(out keyType, out itemType);
this.keyType = factory.GetProjectionTypeUnsafe(keyType );
this.itemType = factory.GetProjectionTypeUnsafe(itemType);
}