Created
August 29, 2014 20:05
-
-
Save jzebedee/b158cbbf5b86038ee5b9 to your computer and use it in GitHub Desktop.
boxing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Value = field.GetValue(this); | |
IOType = valueType = field.FieldType; | |
if (Value is Enum) | |
IOType = enumType = Enum.GetUnderlyingType(valueType); | |
else | |
enumType = null; | |
if (IOType == typeof(float)) | |
writer.Write((float)(object)Value); | |
else if (IOType == typeof(uint)) | |
writer.Write((uint)(object)Value); | |
else if (IOType == typeof(int)) | |
writer.Write((int)(object)Value); | |
else if (IOType == typeof(ushort)) | |
writer.Write((ushort)(object)Value); | |
else if (IOType == typeof(short)) | |
writer.Write((short)(object)Value); | |
else if (IOType == typeof(byte)) | |
writer.Write((byte)(object)Value); | |
else if (IOType == typeof(sbyte)) | |
writer.Write((sbyte)(object)Value); | |
else if (IOType == typeof(bool)) | |
if ((bool)(object)Value) | |
writer.Write((byte)1); | |
else | |
writer.Write((byte)0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment