本文整理汇总了C#中InternalPrimitiveTypeE.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# InternalPrimitiveTypeE.ToString方法的具体用法?C# InternalPrimitiveTypeE.ToString怎么用?C# InternalPrimitiveTypeE.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InternalPrimitiveTypeE
的用法示例。
在下文中一共展示了InternalPrimitiveTypeE.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadValue
// ReadValue from stream using InternalPrimitiveTypeE code
internal object ReadValue(InternalPrimitiveTypeE code)
{
object var = null;
switch (code)
{
case InternalPrimitiveTypeE.Boolean: var = ReadBoolean(); break;
case InternalPrimitiveTypeE.Byte: var = ReadByte(); break;
case InternalPrimitiveTypeE.Char: var = ReadChar(); break;
case InternalPrimitiveTypeE.Double: var = ReadDouble(); break;
case InternalPrimitiveTypeE.Int16: var = ReadInt16(); break;
case InternalPrimitiveTypeE.Int32: var = ReadInt32(); break;
case InternalPrimitiveTypeE.Int64: var = ReadInt64(); break;
case InternalPrimitiveTypeE.SByte: var = ReadSByte(); break;
case InternalPrimitiveTypeE.Single: var = ReadSingle(); break;
case InternalPrimitiveTypeE.UInt16: var = ReadUInt16(); break;
case InternalPrimitiveTypeE.UInt32: var = ReadUInt32(); break;
case InternalPrimitiveTypeE.UInt64: var = ReadUInt64(); break;
case InternalPrimitiveTypeE.Decimal: var = ReadDecimal(); break;
case InternalPrimitiveTypeE.TimeSpan: var = ReadTimeSpan(); break;
case InternalPrimitiveTypeE.DateTime: var = ReadDateTime(); break;
default: throw new SerializationException(SR.Format(SR.Serialization_TypeCode, code.ToString()));
}
return var;
}
示例2: ReadValue
internal object ReadValue(InternalPrimitiveTypeE code)
{
switch (code)
{
case InternalPrimitiveTypeE.Boolean:
return this.ReadBoolean();
case InternalPrimitiveTypeE.Byte:
return this.ReadByte();
case InternalPrimitiveTypeE.Char:
return this.ReadChar();
case InternalPrimitiveTypeE.Decimal:
return this.ReadDecimal();
case InternalPrimitiveTypeE.Double:
return this.ReadDouble();
case InternalPrimitiveTypeE.Int16:
return this.ReadInt16();
case InternalPrimitiveTypeE.Int32:
return this.ReadInt32();
case InternalPrimitiveTypeE.Int64:
return this.ReadInt64();
case InternalPrimitiveTypeE.SByte:
return this.ReadSByte();
case InternalPrimitiveTypeE.Single:
return this.ReadSingle();
case InternalPrimitiveTypeE.TimeSpan:
return this.ReadTimeSpan();
case InternalPrimitiveTypeE.DateTime:
return this.ReadDateTime();
case InternalPrimitiveTypeE.UInt16:
return this.ReadUInt16();
case InternalPrimitiveTypeE.UInt32:
return this.ReadUInt32();
case InternalPrimitiveTypeE.UInt64:
return this.ReadUInt64();
}
throw new SerializationException(Environment.GetResourceString("Serialization_TypeCode", new object[] { code.ToString() }));
}
示例3: WriteValue
internal void WriteValue(InternalPrimitiveTypeE code, object value)
{
switch (code)
{
case InternalPrimitiveTypeE.Boolean:
this.WriteBoolean(Convert.ToBoolean(value, CultureInfo.InvariantCulture));
return;
case InternalPrimitiveTypeE.Byte:
this.WriteByte(Convert.ToByte(value, CultureInfo.InvariantCulture));
return;
case InternalPrimitiveTypeE.Char:
this.WriteChar(Convert.ToChar(value, CultureInfo.InvariantCulture));
return;
case InternalPrimitiveTypeE.Decimal:
this.WriteDecimal(Convert.ToDecimal(value, CultureInfo.InvariantCulture));
return;
case InternalPrimitiveTypeE.Double:
this.WriteDouble(Convert.ToDouble(value, CultureInfo.InvariantCulture));
return;
case InternalPrimitiveTypeE.Int16:
this.WriteInt16(Convert.ToInt16(value, CultureInfo.InvariantCulture));
return;
case InternalPrimitiveTypeE.Int32:
this.WriteInt32(Convert.ToInt32(value, CultureInfo.InvariantCulture));
return;
case InternalPrimitiveTypeE.Int64:
this.WriteInt64(Convert.ToInt64(value, CultureInfo.InvariantCulture));
return;
case InternalPrimitiveTypeE.SByte:
this.WriteSByte(Convert.ToSByte(value, CultureInfo.InvariantCulture));
return;
case InternalPrimitiveTypeE.Single:
this.WriteSingle(Convert.ToSingle(value, CultureInfo.InvariantCulture));
return;
case InternalPrimitiveTypeE.TimeSpan:
this.WriteTimeSpan((TimeSpan) value);
return;
case InternalPrimitiveTypeE.DateTime:
this.WriteDateTime((DateTime) value);
return;
case InternalPrimitiveTypeE.UInt16:
this.WriteUInt16(Convert.ToUInt16(value, CultureInfo.InvariantCulture));
return;
case InternalPrimitiveTypeE.UInt32:
this.WriteUInt32(Convert.ToUInt32(value, CultureInfo.InvariantCulture));
return;
case InternalPrimitiveTypeE.UInt64:
this.WriteUInt64(Convert.ToUInt64(value, CultureInfo.InvariantCulture));
return;
}
throw new SerializationException(Environment.GetResourceString("Serialization_TypeCode", new object[] { code.ToString() }));
}
示例4: WriteValue
// Method to write a value onto a stream given its primitive type code
internal void WriteValue(InternalPrimitiveTypeE code, object value)
{
switch (code)
{
case InternalPrimitiveTypeE.Boolean: WriteBoolean(Convert.ToBoolean(value, CultureInfo.InvariantCulture)); break;
case InternalPrimitiveTypeE.Byte: WriteByte(Convert.ToByte(value, CultureInfo.InvariantCulture)); break;
case InternalPrimitiveTypeE.Char: WriteChar(Convert.ToChar(value, CultureInfo.InvariantCulture)); break;
case InternalPrimitiveTypeE.Double: WriteDouble(Convert.ToDouble(value, CultureInfo.InvariantCulture)); break;
case InternalPrimitiveTypeE.Int16: WriteInt16(Convert.ToInt16(value, CultureInfo.InvariantCulture)); break;
case InternalPrimitiveTypeE.Int32: WriteInt32(Convert.ToInt32(value, CultureInfo.InvariantCulture)); break;
case InternalPrimitiveTypeE.Int64: WriteInt64(Convert.ToInt64(value, CultureInfo.InvariantCulture)); break;
case InternalPrimitiveTypeE.SByte: WriteSByte(Convert.ToSByte(value, CultureInfo.InvariantCulture)); break;
case InternalPrimitiveTypeE.Single: WriteSingle(Convert.ToSingle(value, CultureInfo.InvariantCulture)); break;
case InternalPrimitiveTypeE.UInt16: WriteUInt16(Convert.ToUInt16(value, CultureInfo.InvariantCulture)); break;
case InternalPrimitiveTypeE.UInt32: WriteUInt32(Convert.ToUInt32(value, CultureInfo.InvariantCulture)); break;
case InternalPrimitiveTypeE.UInt64: WriteUInt64(Convert.ToUInt64(value, CultureInfo.InvariantCulture)); break;
case InternalPrimitiveTypeE.Decimal: WriteDecimal(Convert.ToDecimal(value, CultureInfo.InvariantCulture)); break;
case InternalPrimitiveTypeE.TimeSpan: WriteTimeSpan((TimeSpan)value); break;
case InternalPrimitiveTypeE.DateTime: WriteDateTime((DateTime)value); break;
default: throw new SerializationException(SR.Format(SR.Serialization_TypeCode, code.ToString()));
}
}