private static void HandlePrimitive()

in modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveActions.cs [139:263]


        private static void HandlePrimitive(FieldInfo field, out BinaryReflectiveWriteAction writeAction,
            out BinaryReflectiveReadAction readAction, bool raw)
        {
            var type = field.FieldType;

            if (type == typeof (bool))
            {
                writeAction = raw
                    ? GetRawWriter<bool>(field, (w, o) => w.WriteBoolean(o))
                    : GetWriter<bool>(field, (f, w, o) => w.WriteBoolean(f, o));
                readAction = raw
                    ? GetRawReader(field, r => r.ReadBoolean())
                    : GetReader(field, (f, r) => r.ReadBoolean(f));
            }
            else if (type == typeof (sbyte))
            {
                writeAction = raw
                    ? GetRawWriter<sbyte>(field, (w, o) => w.WriteByte(unchecked((byte) o)))
                    : GetWriter<sbyte>(field, (f, w, o) => w.WriteByte(f, unchecked((byte) o)));
                readAction = raw
                    ? GetRawReader(field, r => unchecked ((sbyte) r.ReadByte()))
                    : GetReader(field, (f, r) => unchecked ((sbyte) r.ReadByte(f)));
            }
            else if (type == typeof (byte))
            {
                writeAction = raw
                    ? GetRawWriter<byte>(field, (w, o) => w.WriteByte(o))
                    : GetWriter<byte>(field, (f, w, o) => w.WriteByte(f, o));
                readAction = raw ? GetRawReader(field, r => r.ReadByte()) : GetReader(field, (f, r) => r.ReadByte(f));
            }
            else if (type == typeof (short))
            {
                writeAction = raw
                    ? GetRawWriter<short>(field, (w, o) => w.WriteShort(o))
                    : GetWriter<short>(field, (f, w, o) => w.WriteShort(f, o));
                readAction = raw ? GetRawReader(field, r => r.ReadShort()) : GetReader(field, (f, r) => r.ReadShort(f));
            }
            else if (type == typeof (ushort))
            {
                writeAction = raw
                    ? GetRawWriter<ushort>(field, (w, o) => w.WriteShort(unchecked((short) o)))
                    : GetWriter<ushort>(field, (f, w, o) => w.WriteShort(f, unchecked((short) o)));
                readAction = raw
                    ? GetRawReader(field, r => unchecked((ushort) r.ReadShort()))
                    : GetReader(field, (f, r) => unchecked((ushort) r.ReadShort(f)));
            }
            else if (type == typeof (char))
            {
                writeAction = raw
                    ? GetRawWriter<char>(field, (w, o) => w.WriteChar(o))
                    : GetWriter<char>(field, (f, w, o) => w.WriteChar(f, o));
                readAction = raw ? GetRawReader(field, r => r.ReadChar()) : GetReader(field, (f, r) => r.ReadChar(f));
            }
            else if (type == typeof (int))
            {
                writeAction = raw
                    ? GetRawWriter<int>(field, (w, o) => w.WriteInt(o))
                    : GetWriter<int>(field, (f, w, o) => w.WriteInt(f, o));
                readAction = raw ? GetRawReader(field, r => r.ReadInt()) : GetReader(field, (f, r) => r.ReadInt(f));
            }
            else if (type == typeof (uint))
            {
                writeAction = raw
                    ? GetRawWriter<uint>(field, (w, o) => w.WriteInt(unchecked((int) o)))
                    : GetWriter<uint>(field, (f, w, o) => w.WriteInt(f, unchecked((int) o)));
                readAction = raw
                    ? GetRawReader(field, r => unchecked((uint) r.ReadInt()))
                    : GetReader(field, (f, r) => unchecked((uint) r.ReadInt(f)));
            }
            else if (type == typeof (long))
            {
                writeAction = raw
                    ? GetRawWriter<long>(field, (w, o) => w.WriteLong(o))
                    : GetWriter<long>(field, (f, w, o) => w.WriteLong(f, o));
                readAction = raw ? GetRawReader(field, r => r.ReadLong()) : GetReader(field, (f, r) => r.ReadLong(f));
            }
            else if (type == typeof (ulong))
            {
                writeAction = raw
                    ? GetRawWriter<ulong>(field, (w, o) => w.WriteLong(unchecked((long) o)))
                    : GetWriter<ulong>(field, (f, w, o) => w.WriteLong(f, unchecked((long) o)));
                readAction = raw
                    ? GetRawReader(field, r => unchecked((ulong) r.ReadLong()))
                    : GetReader(field, (f, r) => unchecked((ulong) r.ReadLong(f)));
            }
            else if (type == typeof (float))
            {
                writeAction = raw
                    ? GetRawWriter<float>(field, (w, o) => w.WriteFloat(o))
                    : GetWriter<float>(field, (f, w, o) => w.WriteFloat(f, o));
                readAction = raw ? GetRawReader(field, r => r.ReadFloat()) : GetReader(field, (f, r) => r.ReadFloat(f));
            }
            else if (type == typeof(double))
            {
                writeAction = raw
                    ? GetRawWriter<double>(field, (w, o) => w.WriteDouble(o))
                    : GetWriter<double>(field, (f, w, o) => w.WriteDouble(f, o));
                readAction = raw
                    ? GetRawReader(field, r => r.ReadDouble())
                    : GetReader(field, (f, r) => r.ReadDouble(f));
            }
            else if (type == typeof(IntPtr))
            {
                writeAction = raw
                    ? GetRawWriter<IntPtr>(field, (w, o) => w.WriteLong((long) o))
                    : GetWriter<IntPtr>(field, (f, w, o) => w.WriteLong(f, (long) o));
                readAction = raw
                    ? GetRawReader(field, r => (IntPtr) r.ReadLong())
                    : GetReader(field, (f, r) => (IntPtr) r.ReadLong(f));
            }
            else if (type == typeof(UIntPtr))
            {
                writeAction = raw
                    ? GetRawWriter<UIntPtr>(field, (w, o) => w.WriteLong((long) o))
                    : GetWriter<UIntPtr>(field, (f, w, o) => w.WriteLong(f, (long) o));
                readAction = raw
                    ? GetRawReader(field, r => (UIntPtr) r.ReadLong())
                    : GetReader(field, (f, r) => (UIntPtr) r.ReadLong(f));
            }
            else
            {
                throw new IgniteException(string.Format("Unsupported primitive type '{0}' [Field={1}, " +
                                                        "DeclaringType={2}", type, field, field.DeclaringType));
            }
        }