本文整理汇总了C#中PrimitiveTypeCode类的典型用法代码示例。如果您正苦于以下问题:C# PrimitiveTypeCode类的具体用法?C# PrimitiveTypeCode怎么用?C# PrimitiveTypeCode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PrimitiveTypeCode类属于命名空间,在下文中一共展示了PrimitiveTypeCode类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateReference
/// <summary>
/// Creates a type reference to a namespace type from the given assembly, where the last element of the names
/// array is the name of the type and the other elements are the names of the namespaces.
/// </summary>
/// <param name="assemblyReference">A reference to the assembly that contains the type for which a reference is desired.</param>
/// <param name="isValueType">True if the referenced type is known to be a value type.</param>
/// <param name="genericParameterCount">The number of generic parameters, if any, that the type has must. Must be zero or more.</param>
/// <param name="typeCode">A code that identifies what kind of type is being referenced.</param>
/// <param name="names">The last entry of this array is the name of the type, the others are the names of the containing namespaces.</param>
public INamespaceTypeReference CreateReference(IAssemblyReference assemblyReference, bool isValueType, ushort genericParameterCount, PrimitiveTypeCode typeCode, params string[] names)
{
IUnitNamespaceReference ns = new RootUnitNamespaceReference(assemblyReference);
for (int i = 0, n = names.Length-1; i < n; i++)
ns = new NestedUnitNamespaceReference(ns, this.host.NameTable.GetNameFor(names[i]));
return new NamespaceTypeReference(this.host, ns, this.host.NameTable.GetNameFor(names[names.Length-1]), genericParameterCount, false, isValueType, typeCode);
}
开发者ID:rasiths,项目名称:visual-profiler,代码行数:16,代码来源:PlatformTypes.cs
示例2: JsonPrimitiveContract
/// <summary>
/// Initializes a new instance of the <see cref="JsonPrimitiveContract"/> class.
/// </summary>
/// <param name="underlyingType">The underlying type for the contract.</param>
public JsonPrimitiveContract(Type underlyingType)
: base(underlyingType)
{
ContractType = JsonContractType.Primitive;
// get the underlying enum value
Type t;
if (ReflectionUtils.IsNullableType(underlyingType))
t = Nullable.GetUnderlyingType(underlyingType).IsEnum() ? ReflectionUtils.MakeGenericType(typeof(Nullable<>), Enum.GetUnderlyingType(Nullable.GetUnderlyingType(underlyingType))) : underlyingType;
else
t = underlyingType.IsEnum() ? Enum.GetUnderlyingType(underlyingType) : underlyingType;
PrimitiveTypeCode typeCode;
TypeCodeMap.TryGetValue(t, out typeCode);
TypeCode = typeCode;
}
开发者ID:rdowdall,项目名称:Newtonsoft.Json,代码行数:20,代码来源:JsonPrimitiveContract.cs
示例3: DefineLocalConstant
private void DefineLocalConstant(string name, object value, PrimitiveTypeCode typeCode, uint constantSignatureToken)
{
if (value == null)
{
// ISymUnmanagedWriter2.DefineConstant2 throws an ArgumentException
// if you pass in null - Dev10 appears to use 0 instead.
// (See EMITTER::VariantFromConstVal)
value = 0;
typeCode = PrimitiveTypeCode.Int32;
}
if (typeCode == PrimitiveTypeCode.String)
{
DefineLocalStringConstant(name, (string)value, constantSignatureToken);
}
else if (value is DateTime)
{
// Marshal.GetNativeVariantForObject would create a variant with type VT_DATE and value equal to the
// number of days since 1899/12/30. However, ConstantValue::VariantFromConstant in the native VB
// compiler actually created a variant with type VT_DATE and value equal to the tick count.
// http://blogs.msdn.com/b/ericlippert/archive/2003/09/16/eric-s-complete-guide-to-vt-date.aspx
var dt = (DateTime)value;
_symWriter.DefineConstant2(name, new VariantStructure(dt), constantSignatureToken);
if (_callLogger.LogOperation(OP.DefineConstant2))
{
_callLogger.LogArgument(name);
_callLogger.LogArgument(constantSignatureToken);
_callLogger.LogArgument(dt.ToBinary());
}
}
else
{
try
{
DefineLocalConstantImpl(name, value, constantSignatureToken);
if (_callLogger.LogOperation(OP.DefineConstant2))
{
_callLogger.LogArgument(name);
_callLogger.LogArgument(constantSignatureToken);
_callLogger.LogArgument(value);
}
}
catch (Exception ex)
{
throw new PdbWritingException(ex);
}
}
}
开发者ID:binsys,项目名称:roslyn,代码行数:48,代码来源:PdbWriter.cs
示例4: WriteValue
internal static void WriteValue(JsonWriter writer, PrimitiveTypeCode typeCode, object value)
{
switch (typeCode)
{
case PrimitiveTypeCode.Char:
writer.WriteValue((char)value);
break;
case PrimitiveTypeCode.CharNullable:
writer.WriteValue((value == null) ? (char?)null : (char)value);
break;
case PrimitiveTypeCode.Boolean:
writer.WriteValue((bool)value);
break;
case PrimitiveTypeCode.BooleanNullable:
writer.WriteValue((value == null) ? (bool?)null : (bool)value);
break;
case PrimitiveTypeCode.SByte:
writer.WriteValue((sbyte)value);
break;
case PrimitiveTypeCode.SByteNullable:
writer.WriteValue((value == null) ? (sbyte?)null : (sbyte)value);
break;
case PrimitiveTypeCode.Int16:
writer.WriteValue((short)value);
break;
case PrimitiveTypeCode.Int16Nullable:
writer.WriteValue((value == null) ? (short?)null : (short)value);
break;
case PrimitiveTypeCode.UInt16:
writer.WriteValue((ushort)value);
break;
case PrimitiveTypeCode.UInt16Nullable:
writer.WriteValue((value == null) ? (ushort?)null : (ushort)value);
break;
case PrimitiveTypeCode.Int32:
writer.WriteValue((int)value);
break;
case PrimitiveTypeCode.Int32Nullable:
writer.WriteValue((value == null) ? (int?)null : (int)value);
break;
case PrimitiveTypeCode.Byte:
writer.WriteValue((byte)value);
break;
case PrimitiveTypeCode.ByteNullable:
writer.WriteValue((value == null) ? (byte?)null : (byte)value);
break;
case PrimitiveTypeCode.UInt32:
writer.WriteValue((uint)value);
break;
case PrimitiveTypeCode.UInt32Nullable:
writer.WriteValue((value == null) ? (uint?)null : (uint)value);
break;
case PrimitiveTypeCode.Int64:
writer.WriteValue((long)value);
break;
case PrimitiveTypeCode.Int64Nullable:
writer.WriteValue((value == null) ? (long?)null : (long)value);
break;
case PrimitiveTypeCode.UInt64:
writer.WriteValue((ulong)value);
break;
case PrimitiveTypeCode.UInt64Nullable:
writer.WriteValue((value == null) ? (ulong?)null : (ulong)value);
break;
case PrimitiveTypeCode.Single:
writer.WriteValue((float)value);
break;
case PrimitiveTypeCode.SingleNullable:
writer.WriteValue((value == null) ? (float?)null : (float)value);
break;
case PrimitiveTypeCode.Double:
writer.WriteValue((double)value);
break;
case PrimitiveTypeCode.DoubleNullable:
writer.WriteValue((value == null) ? (double?)null : (double)value);
break;
case PrimitiveTypeCode.DateTime:
writer.WriteValue((DateTime)value);
break;
case PrimitiveTypeCode.DateTimeNullable:
writer.WriteValue((value == null) ? (DateTime?)null : (DateTime)value);
break;
#if !NET20
case PrimitiveTypeCode.DateTimeOffset:
writer.WriteValue((DateTimeOffset)value);
break;
case PrimitiveTypeCode.DateTimeOffsetNullable:
writer.WriteValue((value == null) ? (DateTimeOffset?)null : (DateTimeOffset)value);
break;
#endif
case PrimitiveTypeCode.Decimal:
writer.WriteValue((decimal)value);
break;
case PrimitiveTypeCode.DecimalNullable:
writer.WriteValue((value == null) ? (decimal?)null : (decimal)value);
break;
case PrimitiveTypeCode.Guid:
writer.WriteValue((Guid)value);
break;
case PrimitiveTypeCode.GuidNullable:
//.........这里部分代码省略.........
开发者ID:Jessecar96,项目名称:Newtonsoft.Json,代码行数:101,代码来源:JsonWriter.cs
示例5: ReadValue
private static object ReadValue(PrimitiveTypeCode primitiveTypeCode, BinaryReader reader)
{
switch (primitiveTypeCode) {
case PrimitiveTypeCode.Boolean: return reader.ReadBoolean();
case PrimitiveTypeCode.Char: return reader.ReadChar();
case PrimitiveTypeCode.Float32: return reader.ReadSingle();
case PrimitiveTypeCode.Float64: return reader.ReadDouble();
case PrimitiveTypeCode.Int16: return reader.ReadInt16();
case PrimitiveTypeCode.Int32: return reader.ReadInt32();
case PrimitiveTypeCode.Int64: return reader.ReadInt64();
case PrimitiveTypeCode.Int8: return reader.ReadSByte();
case PrimitiveTypeCode.UInt16: return reader.ReadUInt16();
case PrimitiveTypeCode.UInt32: return reader.ReadUInt32();
case PrimitiveTypeCode.UInt64: return reader.ReadUInt64();
case PrimitiveTypeCode.UInt8: return reader.ReadByte();
default:
Debug.Assert(false);
break;
}
return null;
}
开发者ID:riverar,项目名称:devtools,代码行数:21,代码来源:PatternDecompiler.cs
示例6: DefineLocalConstant
public void DefineLocalConstant(string name, object value, PrimitiveTypeCode typeCode, uint constantSignatureToken)
{
if (value == null)
{
// ISymUnmanagedWriter2.DefineConstant2 throws an ArgumentException
// if you pass in null - Dev10 appears to use 0 instead.
// (See EMITTER::VariantFromConstVal)
value = 0;
typeCode = PrimitiveTypeCode.Int32;
}
if (typeCode == PrimitiveTypeCode.String)
{
DefineLocalStringConstant(name, (string)value, constantSignatureToken);
}
else
{
try
{
this.symWriter.DefineConstant2(name, value, constantSignatureToken);
}
catch (Exception ex)
{
throw new PdbWritingException(ex);
}
}
}
开发者ID:riversky,项目名称:roslyn,代码行数:27,代码来源:PdbWriter.cs
示例7: WriteValue
internal static void WriteValue(JsonWriter writer, PrimitiveTypeCode typeCode, object value)
{
switch (typeCode)
{
case PrimitiveTypeCode.Char:
writer.WriteValue((char)value);
break;
case PrimitiveTypeCode.CharNullable:
writer.WriteValue((value == null) ? (char?)null : (char)value);
break;
case PrimitiveTypeCode.Boolean:
writer.WriteValue((bool)value);
break;
case PrimitiveTypeCode.BooleanNullable:
writer.WriteValue((value == null) ? (bool?)null : (bool)value);
break;
case PrimitiveTypeCode.SByte:
writer.WriteValue((sbyte)value);
break;
case PrimitiveTypeCode.SByteNullable:
writer.WriteValue((value == null) ? (sbyte?)null : (sbyte)value);
break;
case PrimitiveTypeCode.Int16:
writer.WriteValue((short)value);
break;
case PrimitiveTypeCode.Int16Nullable:
writer.WriteValue((value == null) ? (short?)null : (short)value);
break;
case PrimitiveTypeCode.UInt16:
writer.WriteValue((ushort)value);
break;
case PrimitiveTypeCode.UInt16Nullable:
writer.WriteValue((value == null) ? (ushort?)null : (ushort)value);
break;
case PrimitiveTypeCode.Int32:
writer.WriteValue((int)value);
break;
case PrimitiveTypeCode.Int32Nullable:
writer.WriteValue((value == null) ? (int?)null : (int)value);
break;
case PrimitiveTypeCode.Byte:
writer.WriteValue((byte)value);
break;
case PrimitiveTypeCode.ByteNullable:
writer.WriteValue((value == null) ? (byte?)null : (byte)value);
break;
case PrimitiveTypeCode.UInt32:
writer.WriteValue((uint)value);
break;
case PrimitiveTypeCode.UInt32Nullable:
writer.WriteValue((value == null) ? (uint?)null : (uint)value);
break;
case PrimitiveTypeCode.Int64:
writer.WriteValue((long)value);
break;
case PrimitiveTypeCode.Int64Nullable:
writer.WriteValue((value == null) ? (long?)null : (long)value);
break;
case PrimitiveTypeCode.UInt64:
writer.WriteValue((ulong)value);
break;
case PrimitiveTypeCode.UInt64Nullable:
writer.WriteValue((value == null) ? (ulong?)null : (ulong)value);
break;
case PrimitiveTypeCode.Single:
writer.WriteValue((float)value);
break;
case PrimitiveTypeCode.SingleNullable:
writer.WriteValue((value == null) ? (float?)null : (float)value);
break;
case PrimitiveTypeCode.Double:
writer.WriteValue((double)value);
break;
case PrimitiveTypeCode.DoubleNullable:
writer.WriteValue((value == null) ? (double?)null : (double)value);
break;
case PrimitiveTypeCode.DateTime:
writer.WriteValue((DateTime)value);
break;
case PrimitiveTypeCode.DateTimeNullable:
writer.WriteValue((value == null) ? (DateTime?)null : (DateTime)value);
break;
case PrimitiveTypeCode.DateTimeOffset:
writer.WriteValue((DateTimeOffset)value);
break;
case PrimitiveTypeCode.DateTimeOffsetNullable:
writer.WriteValue((value == null) ? (DateTimeOffset?)null : (DateTimeOffset)value);
break;
case PrimitiveTypeCode.Decimal:
writer.WriteValue((decimal)value);
break;
case PrimitiveTypeCode.DecimalNullable:
writer.WriteValue((value == null) ? (decimal?)null : (decimal)value);
break;
case PrimitiveTypeCode.Guid:
writer.WriteValue((Guid)value);
break;
case PrimitiveTypeCode.GuidNullable:
writer.WriteValue((value == null) ? (Guid?)null : (Guid)value);
break;
//.........这里部分代码省略.........
开发者ID:argul,项目名称:tri_battle,代码行数:101,代码来源:RT_JsonWriter.cs
示例8: ReadValue
private static object ReadValue(PrimitiveTypeCode primitiveTypeCode, BinaryReader reader) {
Contract.Requires(reader != null);
switch (primitiveTypeCode) {
case PrimitiveTypeCode.Boolean: return reader.ReadBoolean();
case PrimitiveTypeCode.Char: return (char)reader.ReadUInt16();
case PrimitiveTypeCode.Float32: return reader.ReadSingle();
case PrimitiveTypeCode.Float64: return reader.ReadDouble();
case PrimitiveTypeCode.Int16: return reader.ReadInt16();
case PrimitiveTypeCode.Int32: return reader.ReadInt32();
case PrimitiveTypeCode.Int64: return reader.ReadInt64();
case PrimitiveTypeCode.Int8: return reader.ReadSByte();
case PrimitiveTypeCode.UInt16: return reader.ReadUInt16();
case PrimitiveTypeCode.UInt32: return reader.ReadUInt32();
case PrimitiveTypeCode.UInt64: return reader.ReadUInt64();
case PrimitiveTypeCode.UInt8: return reader.ReadByte();
default:
Contract.Assume(false);
break;
}
return null;
}
开发者ID:Refresh06,项目名称:visualmutator,代码行数:21,代码来源:Patterns.cs
示例9: WriteValue
internal static void WriteValue(JsonWriter writer, PrimitiveTypeCode typeCode, object value)
{
switch (typeCode)
{
case PrimitiveTypeCode.Char:
writer.WriteValue((char)value);
break;
case PrimitiveTypeCode.CharNullable:
writer.WriteValue((char?)value);
break;
case PrimitiveTypeCode.Boolean:
writer.WriteValue((bool)value);
break;
case PrimitiveTypeCode.BooleanNullable:
writer.WriteValue((bool?)value);
break;
case PrimitiveTypeCode.SByte:
writer.WriteValue((sbyte)value);
break;
case PrimitiveTypeCode.SByteNullable:
writer.WriteValue((sbyte?)value);
break;
case PrimitiveTypeCode.Int16:
writer.WriteValue((short)value);
break;
case PrimitiveTypeCode.Int16Nullable:
writer.WriteValue((short?)value);
break;
case PrimitiveTypeCode.UInt16:
writer.WriteValue((ushort)value);
break;
case PrimitiveTypeCode.UInt16Nullable:
writer.WriteValue((ushort?)value);
break;
case PrimitiveTypeCode.Int32:
writer.WriteValue((int)value);
break;
case PrimitiveTypeCode.Int32Nullable:
writer.WriteValue((int?)value);
break;
case PrimitiveTypeCode.Byte:
writer.WriteValue((byte)value);
break;
case PrimitiveTypeCode.ByteNullable:
writer.WriteValue((byte?)value);
break;
case PrimitiveTypeCode.UInt32:
writer.WriteValue((uint)value);
break;
case PrimitiveTypeCode.UInt32Nullable:
writer.WriteValue((uint?)value);
break;
case PrimitiveTypeCode.Int64:
writer.WriteValue((long)value);
break;
case PrimitiveTypeCode.Int64Nullable:
writer.WriteValue((long?)value);
break;
case PrimitiveTypeCode.UInt64:
writer.WriteValue((ulong)value);
break;
case PrimitiveTypeCode.UInt64Nullable:
writer.WriteValue((ulong?)value);
break;
case PrimitiveTypeCode.Single:
writer.WriteValue((float)value);
break;
case PrimitiveTypeCode.SingleNullable:
writer.WriteValue((float?)value);
break;
case PrimitiveTypeCode.Double:
writer.WriteValue((double)value);
break;
case PrimitiveTypeCode.DoubleNullable:
writer.WriteValue((double?)value);
break;
case PrimitiveTypeCode.DateTime:
writer.WriteValue((DateTime)value);
break;
case PrimitiveTypeCode.DateTimeNullable:
writer.WriteValue((DateTime?)value);
break;
case PrimitiveTypeCode.Decimal:
writer.WriteValue((decimal)value);
break;
case PrimitiveTypeCode.DecimalNullable:
writer.WriteValue((decimal?)value);
break;
case PrimitiveTypeCode.Guid:
writer.WriteValue((Guid)value);
break;
case PrimitiveTypeCode.GuidNullable:
writer.WriteValue((Guid?)value);
break;
case PrimitiveTypeCode.TimeSpan:
writer.WriteValue((TimeSpan)value);
break;
case PrimitiveTypeCode.TimeSpanNullable:
writer.WriteValue((TimeSpan?)value);
break;
//.........这里部分代码省略.........
开发者ID:Bluesubstance,项目名称:Unity3d_Login_Example_Project,代码行数:101,代码来源:JsonWriter.cs
示例10: EmitParametersOfFunctionPointer
private void EmitParametersOfFunctionPointer(bool first, IEnumerable<IParameterTypeInformation> parameters, PrimitiveTypeCode typeCode) {
Contract.Requires(parameters != null);
foreach (var par in parameters) {
Contract.Assume(par != null);
var parType = par.Type.ResolvedType;
if (first) first = false;
else this.sourceEmitter.EmitString(", ");
if (par.IsByReference || (parType.IsValueType && !IsScalarInC(parType)))
this.sourceEmitter.EmitString("uintptr_t ");
else
this.EmitTypeReference(parType, storageLocation: true);
}
if (typeCode != PrimitiveTypeCode.Void) {
if (first) first = false;
else this.sourceEmitter.EmitString(", ");
this.sourceEmitter.EmitString("uintptr_t");
}
this.sourceEmitter.EmitString(")");
}
开发者ID:mestriga,项目名称:Microsoft.CciSamples,代码行数:19,代码来源:TypeReferences.cs
示例11: PrimitiveType
/// <summary>
/// Writes primitive type code.
/// </summary>
/// <param name="type">Any primitive type code except for <see cref="PrimitiveTypeCode.TypedReference"/> and <see cref="PrimitiveTypeCode.Void"/>.</param>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="type"/> is not valid in this context.</exception>
public void PrimitiveType(PrimitiveTypeCode type)
{
switch (type)
{
case PrimitiveTypeCode.Boolean:
case PrimitiveTypeCode.Byte:
case PrimitiveTypeCode.SByte:
case PrimitiveTypeCode.Char:
case PrimitiveTypeCode.Int16:
case PrimitiveTypeCode.UInt16:
case PrimitiveTypeCode.Int32:
case PrimitiveTypeCode.UInt32:
case PrimitiveTypeCode.Int64:
case PrimitiveTypeCode.UInt64:
case PrimitiveTypeCode.Single:
case PrimitiveTypeCode.Double:
case PrimitiveTypeCode.IntPtr:
case PrimitiveTypeCode.UIntPtr:
case PrimitiveTypeCode.String:
case PrimitiveTypeCode.Object:
Builder.WriteByte((byte)type);
return;
case PrimitiveTypeCode.TypedReference:
case PrimitiveTypeCode.Void:
default:
Throw.ArgumentOutOfRange(nameof(type));
return;
}
}
开发者ID:sepidehMS,项目名称:corefx,代码行数:35,代码来源:BlobEncoders.cs
示例12: GetTypeFor
public INamespaceTypeReference GetTypeFor(PrimitiveTypeCode typeCode)
{
switch (typeCode) {
case PrimitiveTypeCode.Float32: return this.SystemFloat32;
case PrimitiveTypeCode.Float64: return this.SystemFloat64;
case PrimitiveTypeCode.Int16: return this.SystemInt16;
case PrimitiveTypeCode.Int32: return this.SystemInt32;
case PrimitiveTypeCode.Int64: return this.SystemInt64;
case PrimitiveTypeCode.Int8: return this.SystemInt8;
case PrimitiveTypeCode.IntPtr: return this.SystemIntPtr;
case PrimitiveTypeCode.UInt16: return this.SystemUInt16;
case PrimitiveTypeCode.UInt32: return this.SystemUInt32;
case PrimitiveTypeCode.UInt64: return this.SystemUInt64;
case PrimitiveTypeCode.UInt8: return this.SystemUInt8;
case PrimitiveTypeCode.UIntPtr: return this.SystemUIntPtr;
case PrimitiveTypeCode.Void: return this.SystemVoid;
default:
//^ assume false; //TODO: make Boogie aware of distinction between bit maps and enums
return Dummy.NamespaceTypeReference;
}
}
开发者ID:rasiths,项目名称:visual-profiler,代码行数:21,代码来源:PlatformTypes.cs
示例13: WritePrimitiveType
internal static void WritePrimitiveType(BlobBuilder builder, PrimitiveTypeCode type)
{
switch (type)
{
case PrimitiveTypeCode.Boolean:
case PrimitiveTypeCode.Byte:
case PrimitiveTypeCode.SByte:
case PrimitiveTypeCode.Char:
case PrimitiveTypeCode.Int16:
case PrimitiveTypeCode.UInt16:
case PrimitiveTypeCode.Int32:
case PrimitiveTypeCode.UInt32:
case PrimitiveTypeCode.Int64:
case PrimitiveTypeCode.UInt64:
case PrimitiveTypeCode.Single:
case PrimitiveTypeCode.Double:
case PrimitiveTypeCode.IntPtr:
case PrimitiveTypeCode.UIntPtr:
case PrimitiveTypeCode.String:
case PrimitiveTypeCode.Object:
builder.WriteByte((byte)type);
return;
// TODO: should we allow these?
case PrimitiveTypeCode.TypedReference:
case PrimitiveTypeCode.Void:
default:
Throw.ArgumentOutOfRange(nameof(type));
return;
}
}
开发者ID:MichalStrehovsky,项目名称:corefx,代码行数:31,代码来源:BlobEncoders.cs
示例14: NamespaceTypeReference
/// <summary>
/// Allocates a type definition that is a member of a namespace definition.
/// </summary>
/// <param name="host">Provides a standard abstraction over the applications that host components that provide or consume objects from the metadata model.</param>
/// <param name="containingUnitNamespace">The namespace that contains the referenced type.</param>
/// <param name="name">The name of the referenced type.</param>
/// <param name="genericParameterCount">The number of generic parameters. Zero if the type is not generic.</param>
/// <param name="isEnum">True if the type is an enumeration (it extends System.Enum and is sealed). Corresponds to C# enum.</param>
/// <param name="isValueType">True if the referenced type is a value type.</param>
/// <param name="typeCode">A value indicating if the type is a primitive type or not.</param>
public NamespaceTypeReference(IMetadataHost host, IUnitNamespaceReference containingUnitNamespace, IName name, ushort genericParameterCount, bool isEnum, bool isValueType, PrimitiveTypeCode typeCode)
: base(host, isEnum, isValueType)
{
Contract.Requires(host != null);
Contract.Requires(containingUnitNamespace != null);
Contract.Requires(name != null);
this.containingUnitNamespace = containingUnitNamespace;
this.name = name;
this.genericParameterCount = genericParameterCount;
this.typeCode = typeCode;
}
开发者ID:rasiths,项目名称:visual-profiler,代码行数:22,代码来源:PlatformTypes.cs
示例15: GetTypeFor
public INamespaceTypeReference GetTypeFor(PrimitiveTypeCode typeCode) {
return Dummy.NamespaceTypeReference;
}
开发者ID:modulexcite,项目名称:Microsoft.Cci.Metadata,代码行数:3,代码来源:DummyObjects.cs
示例16: WriteValue
internal static void WriteValue(JsonWriter writer, PrimitiveTypeCode typeCode, object value)
{
switch (typeCode)
{
case PrimitiveTypeCode.Char:
writer.WriteValue((char)value);
break;
case PrimitiveTypeCode.CharNullable:
writer.WriteValue((value == null) ? (char?)null : (char)value);
break;
case PrimitiveTypeCode.Boolean:
writer.WriteValue((bool)value);
break;
case PrimitiveTypeCode.BooleanNullable:
writer.WriteValue((value == null) ? (bool?)null : (bool)value);
break;
case PrimitiveTypeCode.SByte:
writer.WriteValue((sbyte)value);
break;
case PrimitiveTypeCode.SByteNullable:
writer.WriteValue((value == null) ? (sbyte?)null : (sbyte)value);
break;
case PrimitiveTypeCode.Int16:
writer.WriteValue((short)value);
break;
case PrimitiveTypeCode.Int16Nullable:
writer.WriteValue((value == null) ? (short?)null : (short)value);
break;
case PrimitiveTypeCode.UInt16:
writer.WriteValue((ushort)value);
break;
case PrimitiveTypeCode.UInt16Nullable:
writer.WriteValue((value == null) ? (ushort?)null : (ushort)value);
break;
case PrimitiveTypeCode.Int32:
writer.WriteValue((int)value);
break;
case PrimitiveTypeCode.Int32Nullable:
writer.WriteValue((value == null) ? (int?)null : (int)value);
break;
case PrimitiveTypeCode.Byte:
writer.WriteValue((byte)value);
break;
case PrimitiveTypeCode.ByteNullable:
writer.WriteValue((value == null) ? (byte?)null : (byte)value);
break;
case PrimitiveTypeCode.UInt32:
writer.WriteValue((uint)value);
break;
case PrimitiveTypeCode.UInt32Nullable:
writer.WriteValue((value == null) ? (uint?)null : (uint)value);
break;
case PrimitiveTypeCode.Int64:
writer.WriteValue((long)value);
break;
case PrimitiveTypeCode.Int64Nullable:
writer.WriteValue((value == null) ? (long?)null : (long)value);
break;
case PrimitiveTypeCode.UInt64:
writer.WriteValue((ulong)value);
break;
case PrimitiveTypeCode.UInt64Nullable:
writer.WriteValue((value == null) ? (ulong?)null : (ulong)value);
break;
case PrimitiveTypeCode.Single:
writer.WriteValue((float)value);
break;
case PrimitiveTypeCode.SingleNullable:
writer.WriteValue((value == null) ? (float?)null : (float)value);
break;
case PrimitiveTypeCode.Double:
writer.WriteValue((double)value);
break;
case PrimitiveTypeCode.DoubleNullable:
writer.WriteValue((value == null) ? (double?)null : (double)value);
break;
case PrimitiveTypeCode.DateTime:
writer.WriteValue((DateTime)value);
break;
case PrimitiveTypeCode.DateTimeNullable:
writer.WriteValue((value == null) ? (DateTime?)null : (DateTime)value);
break;
#if !NET20
case PrimitiveTypeCode.DateTimeOffset:
writer.WriteValue((DateTimeOffset)value);
break;
case PrimitiveTypeCode.DateTimeOffsetNullable:
writer.WriteValue((value == null) ? (DateTimeOffset?)null : (DateTimeOffset)value);
break;
#endif
case PrimitiveTypeCode.Decimal:
writer.WriteValue((decimal)value);
break;
case PrimitiveTypeCode.DecimalNullable:
writer.WriteValue((value == null) ? (decimal?)null : (decimal)value);
break;
case PrimitiveTypeCode.Guid:
writer.WriteValue((Guid)value);
break;
case PrimitiveTypeCode.GuidNullable:
//.........这里部分代码省略.........
开发者ID:jrwren,项目名称:yahoofinance,代码行数:101,代码来源:JsonWriter.cs
示例17: WriteValue
// Token: 0x06000144 RID: 324
// RVA: 0x0002AE50 File Offset: 0x00029050
internal static void WriteValue(JsonWriter writer, PrimitiveTypeCode typeCode, object value)
{
switch (typeCode)
{
case PrimitiveTypeCode.Char:
writer.WriteValue((char)value);
return;
case PrimitiveTypeCode.CharNullable:
writer.WriteValue((value == null) ? null : new char?((char)value));
return;
case PrimitiveTypeCode.Boolean:
writer.WriteValue((bool)value);
return;
case PrimitiveTypeCode.BooleanNullable:
writer.WriteValue((value == null) ? null : new bool?((bool)value));
return;
case PrimitiveTypeCode.SByte:
writer.WriteValue((sbyte)value);
return;
case PrimitiveTypeCode.SByteNullable:
writer.WriteValue((value == null) ? null : new sbyte?((sbyte)value));
return;
case PrimitiveTypeCode.Int16:
writer.WriteValue((short)value);
return;
case PrimitiveTypeCode.Int16Nullable:
writer.WriteValue((value == null) ? null : new short?((short)value));
return;
case PrimitiveTypeCode.UInt16:
writer.WriteValue((ushort)value);
return;
case PrimitiveTypeCode.UInt16Nullable:
writer.WriteValue((value == null) ? null : new ushort?((ushort)value));
return;
case PrimitiveTypeCode.Int32:
writer.WriteValue((int)value);
return;
case PrimitiveTypeCode.Int32Nullable:
writer.WriteValue((value == null) ? null : new int?((int)value));
return;
case PrimitiveTypeCode.Byte:
writer.WriteValue((byte)value);
return;
case PrimitiveTypeCode.ByteNullable:
writer.WriteValue((value == null) ? null : new byte?((byte)value));
return;
case PrimitiveTypeCode.UInt32:
writer.WriteValue((uint)value);
return;
case PrimitiveTypeCode.UInt32Nullable:
writer.WriteValue((value == null) ? null : new uint?((uint)value));
return;
case PrimitiveTypeCode.Int64:
writer.WriteValue((long)value);
return;
case PrimitiveTypeCode.Int64Nullable:
writer.WriteValue((value == null) ? null : new long?((long)value));
return;
case PrimitiveTypeCode.UInt64:
writer.WriteValue((ulong)value);
return;
case PrimitiveTypeCode.UInt64Nullable:
writer.WriteValue((value == null) ? null : new ulong?((ulong)value));
return;
case PrimitiveTypeCode.Single:
writer.WriteValue((float)value);
return;
case PrimitiveTypeCode.SingleNullable:
writer.WriteValue((value == null) ? null : new float?((float)value));
return;
case PrimitiveTypeCode.Double:
writer.WriteValue((double)value);
return;
case PrimitiveTypeCode.DoubleNullable:
writer.WriteValue((value == null) ? null : new double?((double)value));
return;
case PrimitiveTypeCode.DateTime:
writer.WriteValue((DateTime)value);
return;
case PrimitiveTypeCode.DateTimeNullable:
writer.WriteValue((value == null) ? null : new DateTime?((DateTime)value));
return;
case PrimitiveTypeCode.Decimal:
writer.WriteValue((decimal)value);
return;
case PrimitiveTypeCode.DecimalNullable:
writer.WriteValue((value == null) ? null : new decimal?((decimal)value));
return;
case PrimitiveTypeCode.Guid:
writer.WriteValue((Guid)value);
return;
case PrimitiveTypeCode.GuidNullable:
writer.WriteValue((value == null) ? null : new Guid?((Guid)value));
return;
case PrimitiveTypeCode.TimeSpan:
writer.WriteValue((TimeSpan)value);
return;
case PrimitiveTypeCode.TimeSpanNullable:
//.........这里部分代码省略.........
开发者ID:newchild,项目名称:Project-DayZero,代码行数:101,代码来源:JsonWriter.cs
示例18: JsonPrimitiveContract
/// <summary>
/// Initializes a new instance of the <see cref="JsonPrimitiveContract"/> class.
/// </summary>
/// <param name="underlyingType">The underlying type for the contract.</param>
public JsonPrimitiveContract(Type underlyingType) : base(underlyingType)
{
ContractType = JsonContractType.Primitive;
TypeCode = ConvertUtils.GetTypeCode(underlyingType);
IsReadOnlyOrFixedSize = true;
}
开发者ID:Chuhukon,项目名称:uWebshop-Releases,代码行数:11,代码来源:JsonPrimitiveContract.cs
示例19: JsonPrimitiveContract
/// <summary>
/// Initializes a new instance of the <see cref="JsonPrimitiveContract"/> class.
/// </summary>
/// <param name="underlyingType">The underlying type for the contract.</param>
public JsonPrimitiveContract(Type underlyingType)
: base(underlyingType)
{
ContractType = JsonContractType.Primitive;
TypeCode = ConvertUtils.GetTypeCode(underlyingType);
IsReadOnlyOrFixedSize = true;
ReadType readType;
if (ReadTypeMap.TryGetValue(NonNullableUnderlyingType, out readType))
{
InternalReadType = readType;
}
}
开发者ID:ChuangYang,项目名称:Newtonsoft.Json,代码行数:18,代码来源:JsonPrimitiveContract.cs
注:本文中的PrimitiveTypeCode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论