本文整理汇总了C#中System.Reflection.Metadata.BlobReader.ReadSingle方法的典型用法代码示例。如果您正苦于以下问题:C# BlobReader.ReadSingle方法的具体用法?C# BlobReader.ReadSingle怎么用?C# BlobReader.ReadSingle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.Metadata.BlobReader
的用法示例。
在下文中一共展示了BlobReader.ReadSingle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadAndTranslateValue
private object ReadAndTranslateValue(ref BlobReader sigReader, SignatureTypeCode typeCode, out bool isEnumTypeCode)
{
switch (typeCode)
{
case SignatureTypeCode.Boolean:
isEnumTypeCode = true;
return (short)(sigReader.ReadBoolean() ? 1 : 0);
case SignatureTypeCode.Char:
isEnumTypeCode = true;
return (ushort)sigReader.ReadChar();
case SignatureTypeCode.SByte:
isEnumTypeCode = true;
return (short)sigReader.ReadSByte();
case SignatureTypeCode.Byte:
isEnumTypeCode = true;
return (short)sigReader.ReadByte();
case SignatureTypeCode.Int16:
isEnumTypeCode = true;
return sigReader.ReadInt16();
case SignatureTypeCode.UInt16:
isEnumTypeCode = true;
return sigReader.ReadUInt16();
case SignatureTypeCode.Int32:
isEnumTypeCode = true;
return sigReader.ReadInt32();
case SignatureTypeCode.UInt32:
isEnumTypeCode = true;
return sigReader.ReadUInt32();
case SignatureTypeCode.Int64:
isEnumTypeCode = true;
return sigReader.ReadInt64();
case SignatureTypeCode.UInt64:
isEnumTypeCode = true;
return sigReader.ReadUInt64();
case SignatureTypeCode.Single:
isEnumTypeCode = false;
return sigReader.ReadSingle();
case SignatureTypeCode.Double:
isEnumTypeCode = false;
return sigReader.ReadDouble();
case SignatureTypeCode.String:
isEnumTypeCode = false;
if (sigReader.RemainingBytes == 1)
{
if (sigReader.ReadByte() != 0xff)
{
throw new BadImageFormatException();
}
return NullReferenceValue;
}
if (sigReader.RemainingBytes % 2 != 0)
{
throw new BadImageFormatException();
}
return sigReader.ReadUTF16(sigReader.RemainingBytes);
case SignatureTypeCode.Object:
// null reference
isEnumTypeCode = false;
return NullReferenceValue;
default:
throw new BadImageFormatException();
}
}