IGNITE-6233 .NET: Extract type codes to a separate class

This closes #2570


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/55e0b5c9
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/55e0b5c9
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/55e0b5c9

Branch: refs/heads/ignite-3478-1
Commit: 55e0b5c9bf3b0b12ed930dbffea8e5bfced1ef18
Parents: 5738d7e
Author: Pavel Tupitsyn <[email protected]>
Authored: Fri Sep 1 11:49:48 2017 +0300
Committer: Pavel Tupitsyn <[email protected]>
Committed: Fri Sep 1 11:49:48 2017 +0300

----------------------------------------------------------------------
 .../Apache.Ignite.Core.csproj                   |   1 +
 .../Impl/Binary/BinaryObjectBuilder.cs          | 132 +++++------
 .../Impl/Binary/BinaryObjectSchemaSerializer.cs |   2 +-
 .../Impl/Binary/BinaryProcessor.cs              |   2 +-
 .../Impl/Binary/BinaryReader.cs                 | 110 ++++-----
 .../Impl/Binary/BinarySystemHandlers.cs         | 157 ++++---------
 .../Impl/Binary/BinaryTypeId.cs                 | 228 +++++++++++++++++++
 .../Impl/Binary/BinaryUtils.cs                  | 155 +------------
 .../Impl/Binary/BinaryWriter.cs                 | 152 ++++++-------
 .../Impl/Binary/Marshaller.cs                   |  28 +--
 .../Impl/Binary/Metadata/BinaryType.cs          |  62 ++---
 11 files changed, 528 insertions(+), 501 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/55e0b5c9/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj 
b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index ee301be..241e1c6 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -99,6 +99,7 @@
     <Compile Include="Cache\IMemoryMetrics.cs" />
     <Compile Include="Common\ExceptionFactory.cs" />
     <Compile Include="Configuration\Package-Info.cs" />
+    <Compile Include="Impl\Binary\BinaryTypeId.cs" />
     <Compile Include="Impl\IIgniteInternal.cs" />
     <Compile Include="Impl\IPlatformTargetInternal.cs" />
     <Compile Include="Impl\PersistentStore\PersistentStoreMetrics.cs" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/55e0b5c9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
----------------------------------------------------------------------
diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
 
b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
index c310b3a..fac7d18 100644
--- 
a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
+++ 
b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
@@ -124,209 +124,209 @@ namespace Apache.Ignite.Core.Impl.Binary
         public IBinaryObjectBuilder SetField<T>(string fieldName, T val)
         {
             return SetField0(fieldName,
-                new BinaryBuilderField(typeof (T), val, 
BinarySystemHandlers.GetTypeId(typeof (T))));
+                new BinaryBuilderField(typeof (T), val, 
BinaryTypeId.GetTypeId(typeof (T))));
         }
 
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetArrayField<T>(string fieldName, T[] val)
         {
             return SetField0(fieldName,
-                new BinaryBuilderField(typeof (T[]), val, 
BinaryUtils.TypeArray, WriteArrayAction));
+                new BinaryBuilderField(typeof (T[]), val, BinaryTypeId.Array, 
WriteArrayAction));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetBooleanField(string fieldName, bool val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof (bool), 
val, BinaryUtils.TypeBool, 
+            return SetField0(fieldName, new BinaryBuilderField(typeof (bool), 
val, BinaryTypeId.Bool, 
                 (w, o) => w.WriteBooleanField((bool) o)));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetBooleanArrayField(string fieldName, 
bool[] val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof 
(bool[]), val, BinaryUtils.TypeArrayBool,
+            return SetField0(fieldName, new BinaryBuilderField(typeof 
(bool[]), val, BinaryTypeId.ArrayBool,
                 (w, o) => w.WriteBooleanArray((bool[]) o)));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetByteField(string fieldName, byte val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof (byte), 
val, BinaryUtils.TypeByte,
+            return SetField0(fieldName, new BinaryBuilderField(typeof (byte), 
val, BinaryTypeId.Byte,
                 (w, o) => w.WriteByteField((byte) o)));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetByteArrayField(string fieldName, byte[] 
val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof 
(byte[]), val, BinaryUtils.TypeArrayByte,
+            return SetField0(fieldName, new BinaryBuilderField(typeof 
(byte[]), val, BinaryTypeId.ArrayByte,
                 (w, o) => w.WriteByteArray((byte[]) o)));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetCharField(string fieldName, char val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof (char), 
val, BinaryUtils.TypeChar,
+            return SetField0(fieldName, new BinaryBuilderField(typeof (char), 
val, BinaryTypeId.Char,
                 (w, o) => w.WriteCharField((char) o)));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetCharArrayField(string fieldName, char[] 
val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof 
(char[]), val, BinaryUtils.TypeArrayChar,
+            return SetField0(fieldName, new BinaryBuilderField(typeof 
(char[]), val, BinaryTypeId.ArrayChar,
                 (w, o) => w.WriteCharArray((char[]) o)));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetCollectionField(string fieldName, 
ICollection val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof 
(ICollection), val, BinaryUtils.TypeCollection,
+            return SetField0(fieldName, new BinaryBuilderField(typeof 
(ICollection), val, BinaryTypeId.Collection,
                 WriteCollectionAction));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetDecimalField(string fieldName, decimal? 
val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof 
(decimal?), val, BinaryUtils.TypeDecimal,
+            return SetField0(fieldName, new BinaryBuilderField(typeof 
(decimal?), val, BinaryTypeId.Decimal,
                 (w, o) => w.WriteDecimal((decimal?) o)));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetDecimalArrayField(string fieldName, 
decimal?[] val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof 
(decimal?[]), val, BinaryUtils.TypeArrayDecimal,
+            return SetField0(fieldName, new BinaryBuilderField(typeof 
(decimal?[]), val, BinaryTypeId.ArrayDecimal,
                 (w, o) => w.WriteDecimalArray((decimal?[]) o)));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetDictionaryField(string fieldName, 
IDictionary val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof 
(IDictionary), val, BinaryUtils.TypeDictionary,
+            return SetField0(fieldName, new BinaryBuilderField(typeof 
(IDictionary), val, BinaryTypeId.Dictionary,
                 (w, o) => w.WriteDictionary((IDictionary) o)));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetDoubleField(string fieldName, double 
val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof 
(double), val, BinaryUtils.TypeDouble,
+            return SetField0(fieldName, new BinaryBuilderField(typeof 
(double), val, BinaryTypeId.Double,
                 (w, o) => w.WriteDoubleField((double) o)));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetDoubleArrayField(string fieldName, 
double[] val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof 
(double[]), val, BinaryUtils.TypeArrayDouble,
+            return SetField0(fieldName, new BinaryBuilderField(typeof 
(double[]), val, BinaryTypeId.ArrayDouble,
                 (w, o) => w.WriteDoubleArray((double[]) o)));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetEnumField<T>(string fieldName, T val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof (T), 
val, BinaryUtils.TypeEnum,
+            return SetField0(fieldName, new BinaryBuilderField(typeof (T), 
val, BinaryTypeId.Enum,
                 (w, o) => w.WriteEnum((T) o)));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetEnumArrayField<T>(string fieldName, T[] 
val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof (T[]), 
val, BinaryUtils.TypeArrayEnum,
+            return SetField0(fieldName, new BinaryBuilderField(typeof (T[]), 
val, BinaryTypeId.ArrayEnum,
                 (w, o) => w.WriteEnumArray((T[]) o)));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetFloatField(string fieldName, float val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof (float), 
val, BinaryUtils.TypeFloat,
+            return SetField0(fieldName, new BinaryBuilderField(typeof (float), 
val, BinaryTypeId.Float,
                 (w, o) => w.WriteFloatField((float) o)));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetFloatArrayField(string fieldName, 
float[] val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof 
(float[]), val, BinaryUtils.TypeArrayFloat,
+            return SetField0(fieldName, new BinaryBuilderField(typeof 
(float[]), val, BinaryTypeId.ArrayFloat,
                 (w, o) => w.WriteFloatArray((float[]) o)));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetGuidField(string fieldName, Guid? val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof (Guid?), 
val, BinaryUtils.TypeGuid,
+            return SetField0(fieldName, new BinaryBuilderField(typeof (Guid?), 
val, BinaryTypeId.Guid,
                 (w, o) => w.WriteGuid((Guid?) o)));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetGuidArrayField(string fieldName, 
Guid?[] val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof 
(Guid?[]), val, BinaryUtils.TypeArrayGuid,
+            return SetField0(fieldName, new BinaryBuilderField(typeof 
(Guid?[]), val, BinaryTypeId.ArrayGuid,
                 (w, o) => w.WriteGuidArray((Guid?[]) o)));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetIntField(string fieldName, int val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof (int), 
val, BinaryUtils.TypeInt,
+            return SetField0(fieldName, new BinaryBuilderField(typeof (int), 
val, BinaryTypeId.Int,
                 (w, o) => w.WriteIntField((int) o)));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetIntArrayField(string fieldName, int[] 
val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof (int[]), 
val, BinaryUtils.TypeArrayInt,
+            return SetField0(fieldName, new BinaryBuilderField(typeof (int[]), 
val, BinaryTypeId.ArrayInt,
                 (w, o) => w.WriteIntArray((int[]) o)));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetLongField(string fieldName, long val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof (long), 
val, BinaryUtils.TypeLong,
+            return SetField0(fieldName, new BinaryBuilderField(typeof (long), 
val, BinaryTypeId.Long,
                 (w, o) => w.WriteLongField((long) o)));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetLongArrayField(string fieldName, long[] 
val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof 
(long[]), val, BinaryUtils.TypeArrayLong,
+            return SetField0(fieldName, new BinaryBuilderField(typeof 
(long[]), val, BinaryTypeId.ArrayLong,
                 (w, o) => w.WriteLongArray((long[]) o)));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetShortField(string fieldName, short val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof (short), 
val, BinaryUtils.TypeShort,
+            return SetField0(fieldName, new BinaryBuilderField(typeof (short), 
val, BinaryTypeId.Short,
                 (w, o) => w.WriteShortField((short) o)));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetShortArrayField(string fieldName, 
short[] val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof 
(short[]), val, BinaryUtils.TypeArrayShort,
+            return SetField0(fieldName, new BinaryBuilderField(typeof 
(short[]), val, BinaryTypeId.ArrayShort,
                 (w, o) => w.WriteShortArray((short[]) o)));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetStringField(string fieldName, string 
val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof 
(string), val, BinaryUtils.TypeString,
+            return SetField0(fieldName, new BinaryBuilderField(typeof 
(string), val, BinaryTypeId.String,
                 (w, o) => w.WriteString((string) o)));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetStringArrayField(string fieldName, 
string[] val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof 
(string[]), val, BinaryUtils.TypeArrayString,
+            return SetField0(fieldName, new BinaryBuilderField(typeof 
(string[]), val, BinaryTypeId.ArrayString,
                 (w, o) => w.WriteStringArray((string[]) o)));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetTimestampField(string fieldName, 
DateTime? val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof 
(DateTime?), val, BinaryUtils.TypeTimestamp,
+            return SetField0(fieldName, new BinaryBuilderField(typeof 
(DateTime?), val, BinaryTypeId.Timestamp,
                 WriteTimestampAction));
         }
  
         /** <inheritDoc /> */
         public IBinaryObjectBuilder SetTimestampArrayField(string fieldName, 
DateTime?[] val)
         {
-            return SetField0(fieldName, new BinaryBuilderField(typeof 
(DateTime?[]), val, BinaryUtils.TypeArrayTimestamp,
+            return SetField0(fieldName, new BinaryBuilderField(typeof 
(DateTime?[]), val, BinaryTypeId.ArrayTimestamp,
                 WriteTimestampArrayAction));
         } 
 
@@ -440,19 +440,19 @@ namespace Apache.Ignite.Core.Impl.Binary
 
             switch (header)
             {
-                case BinaryUtils.TypeArray:
+                case BinaryTypeId.Array:
                     return WriteArrayAction;
 
-                case BinaryUtils.TypeCollection:
+                case BinaryTypeId.Collection:
                     return WriteCollectionAction;
 
-                case BinaryUtils.TypeTimestamp:
+                case BinaryTypeId.Timestamp:
                     return WriteTimestampAction;
 
-                case BinaryUtils.TypeArrayTimestamp:
+                case BinaryTypeId.ArrayTimestamp:
                     return WriteTimestampArrayAction;
 
-                case BinaryUtils.TypeArrayEnum:
+                case BinaryTypeId.ArrayEnum:
                     using (var stream = new BinaryHeapStream(_obj.Data))
                     {
                         stream.Seek(pos, SeekOrigin.Begin + 1);
@@ -826,47 +826,47 @@ namespace Apache.Ignite.Core.Impl.Binary
         {
             switch (hdr)
             {
-                case BinaryUtils.TypeByte:
+                case BinaryTypeId.Byte:
                     TransferBytes(inStream, outStream, 1);
 
                     break;
 
-                case BinaryUtils.TypeShort:
+                case BinaryTypeId.Short:
                     TransferBytes(inStream, outStream, 2);
 
                     break;
 
-                case BinaryUtils.TypeInt:
+                case BinaryTypeId.Int:
                     TransferBytes(inStream, outStream, 4);
 
                     break;
 
-                case BinaryUtils.TypeLong:
+                case BinaryTypeId.Long:
                     TransferBytes(inStream, outStream, 8);
 
                     break;
 
-                case BinaryUtils.TypeFloat:
+                case BinaryTypeId.Float:
                     TransferBytes(inStream, outStream, 4);
 
                     break;
 
-                case BinaryUtils.TypeDouble:
+                case BinaryTypeId.Double:
                     TransferBytes(inStream, outStream, 8);
 
                     break;
 
-                case BinaryUtils.TypeChar:
+                case BinaryTypeId.Char:
                     TransferBytes(inStream, outStream, 2);
 
                     break;
 
-                case BinaryUtils.TypeBool:
+                case BinaryTypeId.Bool:
                     TransferBytes(inStream, outStream, 1);
 
                     break;
 
-                case BinaryUtils.TypeDecimal:
+                case BinaryTypeId.Decimal:
                     TransferBytes(inStream, outStream, 4); // Transfer scale
 
                     int magLen = inStream.ReadInt(); // Transfer magnitude 
length.
@@ -877,65 +877,65 @@ namespace Apache.Ignite.Core.Impl.Binary
 
                     break;
 
-                case BinaryUtils.TypeString:
+                case BinaryTypeId.String:
                     BinaryUtils.WriteString(BinaryUtils.ReadString(inStream), 
outStream);
 
                     break;
 
-                case BinaryUtils.TypeGuid:
+                case BinaryTypeId.Guid:
                     TransferBytes(inStream, outStream, 16);
 
                     break;
 
-                case BinaryUtils.TypeTimestamp:
+                case BinaryTypeId.Timestamp:
                     TransferBytes(inStream, outStream, 12);
 
                     break;
 
-                case BinaryUtils.TypeArrayByte:
+                case BinaryTypeId.ArrayByte:
                     TransferArray(inStream, outStream, 1);
 
                     break;
 
-                case BinaryUtils.TypeArrayShort:
+                case BinaryTypeId.ArrayShort:
                     TransferArray(inStream, outStream, 2);
 
                     break;
 
-                case BinaryUtils.TypeArrayInt:
+                case BinaryTypeId.ArrayInt:
                     TransferArray(inStream, outStream, 4);
 
                     break;
 
-                case BinaryUtils.TypeArrayLong:
+                case BinaryTypeId.ArrayLong:
                     TransferArray(inStream, outStream, 8);
 
                     break;
 
-                case BinaryUtils.TypeArrayFloat:
+                case BinaryTypeId.ArrayFloat:
                     TransferArray(inStream, outStream, 4);
 
                     break;
 
-                case BinaryUtils.TypeArrayDouble:
+                case BinaryTypeId.ArrayDouble:
                     TransferArray(inStream, outStream, 8);
 
                     break;
 
-                case BinaryUtils.TypeArrayChar:
+                case BinaryTypeId.ArrayChar:
                     TransferArray(inStream, outStream, 2);
 
                     break;
 
-                case BinaryUtils.TypeArrayBool:
+                case BinaryTypeId.ArrayBool:
                     TransferArray(inStream, outStream, 1);
 
                     break;
 
-                case BinaryUtils.TypeArrayDecimal:
-                case BinaryUtils.TypeArrayString:
-                case BinaryUtils.TypeArrayGuid:
-                case BinaryUtils.TypeArrayTimestamp:
+                case BinaryTypeId.ArrayDecimal:
+                case BinaryTypeId.ArrayString:
+                case BinaryTypeId.ArrayGuid:
+                case BinaryTypeId.ArrayTimestamp:
                     int arrLen = inStream.ReadInt();
 
                     outStream.WriteInt(arrLen);
@@ -945,13 +945,13 @@ namespace Apache.Ignite.Core.Impl.Binary
 
                     break;
 
-                case BinaryUtils.TypeArrayEnum:
-                case BinaryUtils.TypeArray:
+                case BinaryTypeId.ArrayEnum:
+                case BinaryTypeId.Array:
                     int type = inStream.ReadInt();
 
                     outStream.WriteInt(type);
 
-                    if (type == BinaryUtils.TypeUnregistered)
+                    if (type == BinaryTypeId.Unregistered)
                     {
                         outStream.WriteByte(inStream.ReadByte());  // String 
header.
 
@@ -967,7 +967,7 @@ namespace Apache.Ignite.Core.Impl.Binary
 
                     break;
 
-                case BinaryUtils.TypeCollection:
+                case BinaryTypeId.Collection:
                     int colLen = inStream.ReadInt();
 
                     outStream.WriteInt(colLen);
@@ -979,7 +979,7 @@ namespace Apache.Ignite.Core.Impl.Binary
 
                     break;
 
-                case BinaryUtils.TypeDictionary:
+                case BinaryTypeId.Dictionary:
                     int dictLen = inStream.ReadInt();
 
                     outStream.WriteInt(dictLen);
@@ -994,13 +994,13 @@ namespace Apache.Ignite.Core.Impl.Binary
 
                     break;
                     
-                case BinaryUtils.TypeBinary:
+                case BinaryTypeId.Binary:
                     TransferArray(inStream, outStream, 1); // Data array.
                     TransferBytes(inStream, outStream, 4); // Offset in array.
 
                     break;
 
-                case BinaryUtils.TypeEnum:
+                case BinaryTypeId.Enum:
                     TransferBytes(inStream, outStream, 8); // int typeId, int 
value.
 
                     break;

http://git-wip-us.apache.org/repos/asf/ignite/blob/55e0b5c9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectSchemaSerializer.cs
----------------------------------------------------------------------
diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectSchemaSerializer.cs
 
b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectSchemaSerializer.cs
index 2f66f66..0a1b2d1 100644
--- 
a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectSchemaSerializer.cs
+++ 
b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectSchemaSerializer.cs
@@ -254,7 +254,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// </summary>
         private static int[] GetFieldIds(BinaryObjectHeader hdr, 
IIgniteInternal ignite)
         {
-            Debug.Assert(hdr.TypeId != BinaryUtils.TypeUnregistered);
+            Debug.Assert(hdr.TypeId != BinaryTypeId.Unregistered);
 
             int[] fieldIds = null;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/55e0b5c9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
----------------------------------------------------------------------
diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs 
b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
index 69056b3..26b3f15 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
@@ -183,7 +183,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         public bool RegisterType(int id, string typeName)
         {
             Debug.Assert(typeName != null);
-            Debug.Assert(id != BinaryUtils.TypeUnregistered);
+            Debug.Assert(id != BinaryTypeId.Unregistered);
 
             return DoOutOp((int) Op.RegisterType, w =>
             {

http://git-wip-us.apache.org/repos/asf/ignite/blob/55e0b5c9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
----------------------------------------------------------------------
diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs 
b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
index 76237c4..c0fcc7f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
@@ -98,7 +98,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         /** <inheritdoc /> */
         public bool ReadBoolean(string fieldName)
         {
-            return ReadField(fieldName, r => r.ReadBoolean(), 
BinaryUtils.TypeBool);
+            return ReadField(fieldName, r => r.ReadBoolean(), 
BinaryTypeId.Bool);
         }
 
         /** <inheritdoc /> */
@@ -110,19 +110,19 @@ namespace Apache.Ignite.Core.Impl.Binary
         /** <inheritdoc /> */
         public bool[] ReadBooleanArray(string fieldName)
         {
-            return ReadField(fieldName, BinaryUtils.ReadBooleanArray, 
BinaryUtils.TypeArrayBool);
+            return ReadField(fieldName, BinaryUtils.ReadBooleanArray, 
BinaryTypeId.ArrayBool);
         }
 
         /** <inheritdoc /> */
         public bool[] ReadBooleanArray()
         {
-            return Read(BinaryUtils.ReadBooleanArray, 
BinaryUtils.TypeArrayBool);
+            return Read(BinaryUtils.ReadBooleanArray, BinaryTypeId.ArrayBool);
         }
 
         /** <inheritdoc /> */
         public byte ReadByte(string fieldName)
         {
-            return ReadField(fieldName, ReadByte, BinaryUtils.TypeByte);
+            return ReadField(fieldName, ReadByte, BinaryTypeId.Byte);
         }
 
         /** <inheritdoc /> */
@@ -134,19 +134,19 @@ namespace Apache.Ignite.Core.Impl.Binary
         /** <inheritdoc /> */
         public byte[] ReadByteArray(string fieldName)
         {
-            return ReadField(fieldName, BinaryUtils.ReadByteArray, 
BinaryUtils.TypeArrayByte);
+            return ReadField(fieldName, BinaryUtils.ReadByteArray, 
BinaryTypeId.ArrayByte);
         }
 
         /** <inheritdoc /> */
         public byte[] ReadByteArray()
         {
-            return Read(BinaryUtils.ReadByteArray, BinaryUtils.TypeArrayByte);
+            return Read(BinaryUtils.ReadByteArray, BinaryTypeId.ArrayByte);
         }
 
         /** <inheritdoc /> */
         public short ReadShort(string fieldName)
         {
-            return ReadField(fieldName, ReadShort, BinaryUtils.TypeShort);
+            return ReadField(fieldName, ReadShort, BinaryTypeId.Short);
         }
 
         /** <inheritdoc /> */
@@ -158,19 +158,19 @@ namespace Apache.Ignite.Core.Impl.Binary
         /** <inheritdoc /> */
         public short[] ReadShortArray(string fieldName)
         {
-            return ReadField(fieldName, BinaryUtils.ReadShortArray, 
BinaryUtils.TypeArrayShort);
+            return ReadField(fieldName, BinaryUtils.ReadShortArray, 
BinaryTypeId.ArrayShort);
         }
 
         /** <inheritdoc /> */
         public short[] ReadShortArray()
         {
-            return Read(BinaryUtils.ReadShortArray, 
BinaryUtils.TypeArrayShort);
+            return Read(BinaryUtils.ReadShortArray, BinaryTypeId.ArrayShort);
         }
 
         /** <inheritdoc /> */
         public char ReadChar(string fieldName)
         {
-            return ReadField(fieldName, ReadChar, BinaryUtils.TypeChar);
+            return ReadField(fieldName, ReadChar, BinaryTypeId.Char);
         }
 
         /** <inheritdoc /> */
@@ -182,19 +182,19 @@ namespace Apache.Ignite.Core.Impl.Binary
         /** <inheritdoc /> */
         public char[] ReadCharArray(string fieldName)
         {
-            return ReadField(fieldName, BinaryUtils.ReadCharArray, 
BinaryUtils.TypeArrayChar);
+            return ReadField(fieldName, BinaryUtils.ReadCharArray, 
BinaryTypeId.ArrayChar);
         }
 
         /** <inheritdoc /> */
         public char[] ReadCharArray()
         {
-            return Read(BinaryUtils.ReadCharArray, BinaryUtils.TypeArrayChar);
+            return Read(BinaryUtils.ReadCharArray, BinaryTypeId.ArrayChar);
         }
 
         /** <inheritdoc /> */
         public int ReadInt(string fieldName)
         {
-            return ReadField(fieldName, ReadInt, BinaryUtils.TypeInt);
+            return ReadField(fieldName, ReadInt, BinaryTypeId.Int);
         }
 
         /** <inheritdoc /> */
@@ -206,19 +206,19 @@ namespace Apache.Ignite.Core.Impl.Binary
         /** <inheritdoc /> */
         public int[] ReadIntArray(string fieldName)
         {
-            return ReadField(fieldName, BinaryUtils.ReadIntArray, 
BinaryUtils.TypeArrayInt);
+            return ReadField(fieldName, BinaryUtils.ReadIntArray, 
BinaryTypeId.ArrayInt);
         }
 
         /** <inheritdoc /> */
         public int[] ReadIntArray()
         {
-            return Read(BinaryUtils.ReadIntArray, BinaryUtils.TypeArrayInt);
+            return Read(BinaryUtils.ReadIntArray, BinaryTypeId.ArrayInt);
         }
 
         /** <inheritdoc /> */
         public long ReadLong(string fieldName)
         {
-            return ReadField(fieldName, ReadLong, BinaryUtils.TypeLong);
+            return ReadField(fieldName, ReadLong, BinaryTypeId.Long);
         }
 
         /** <inheritdoc /> */
@@ -230,19 +230,19 @@ namespace Apache.Ignite.Core.Impl.Binary
         /** <inheritdoc /> */
         public long[] ReadLongArray(string fieldName)
         {
-            return ReadField(fieldName, BinaryUtils.ReadLongArray, 
BinaryUtils.TypeArrayLong);
+            return ReadField(fieldName, BinaryUtils.ReadLongArray, 
BinaryTypeId.ArrayLong);
         }
 
         /** <inheritdoc /> */
         public long[] ReadLongArray()
         {
-            return Read(BinaryUtils.ReadLongArray, BinaryUtils.TypeArrayLong);
+            return Read(BinaryUtils.ReadLongArray, BinaryTypeId.ArrayLong);
         }
 
         /** <inheritdoc /> */
         public float ReadFloat(string fieldName)
         {
-            return ReadField(fieldName, ReadFloat, BinaryUtils.TypeFloat);
+            return ReadField(fieldName, ReadFloat, BinaryTypeId.Float);
         }
 
         /** <inheritdoc /> */
@@ -254,19 +254,19 @@ namespace Apache.Ignite.Core.Impl.Binary
         /** <inheritdoc /> */
         public float[] ReadFloatArray(string fieldName)
         {
-            return ReadField(fieldName, BinaryUtils.ReadFloatArray, 
BinaryUtils.TypeArrayFloat);
+            return ReadField(fieldName, BinaryUtils.ReadFloatArray, 
BinaryTypeId.ArrayFloat);
         }
 
         /** <inheritdoc /> */
         public float[] ReadFloatArray()
         {
-            return Read(BinaryUtils.ReadFloatArray, 
BinaryUtils.TypeArrayFloat);
+            return Read(BinaryUtils.ReadFloatArray, BinaryTypeId.ArrayFloat);
         }
 
         /** <inheritdoc /> */
         public double ReadDouble(string fieldName)
         {
-            return ReadField(fieldName, ReadDouble, BinaryUtils.TypeDouble);
+            return ReadField(fieldName, ReadDouble, BinaryTypeId.Double);
         }
 
         /** <inheritdoc /> */
@@ -278,109 +278,109 @@ namespace Apache.Ignite.Core.Impl.Binary
         /** <inheritdoc /> */
         public double[] ReadDoubleArray(string fieldName)
         {
-            return ReadField(fieldName, BinaryUtils.ReadDoubleArray, 
BinaryUtils.TypeArrayDouble);
+            return ReadField(fieldName, BinaryUtils.ReadDoubleArray, 
BinaryTypeId.ArrayDouble);
         }
 
         /** <inheritdoc /> */
         public double[] ReadDoubleArray()
         {
-            return Read(BinaryUtils.ReadDoubleArray, 
BinaryUtils.TypeArrayDouble);
+            return Read(BinaryUtils.ReadDoubleArray, BinaryTypeId.ArrayDouble);
         }
 
         /** <inheritdoc /> */
         public decimal? ReadDecimal(string fieldName)
         {
-            return ReadField(fieldName, BinaryUtils.ReadDecimal, 
BinaryUtils.TypeDecimal);
+            return ReadField(fieldName, BinaryUtils.ReadDecimal, 
BinaryTypeId.Decimal);
         }
 
         /** <inheritdoc /> */
         public decimal? ReadDecimal()
         {
-            return Read(BinaryUtils.ReadDecimal, BinaryUtils.TypeDecimal);
+            return Read(BinaryUtils.ReadDecimal, BinaryTypeId.Decimal);
         }
 
         /** <inheritdoc /> */
         public decimal?[] ReadDecimalArray(string fieldName)
         {
-            return ReadField(fieldName, BinaryUtils.ReadDecimalArray, 
BinaryUtils.TypeArrayDecimal);
+            return ReadField(fieldName, BinaryUtils.ReadDecimalArray, 
BinaryTypeId.ArrayDecimal);
         }
 
         /** <inheritdoc /> */
         public decimal?[] ReadDecimalArray()
         {
-            return Read(BinaryUtils.ReadDecimalArray, 
BinaryUtils.TypeArrayDecimal);
+            return Read(BinaryUtils.ReadDecimalArray, 
BinaryTypeId.ArrayDecimal);
         }
 
         /** <inheritdoc /> */
         public DateTime? ReadTimestamp(string fieldName)
         {
-            return ReadField(fieldName, BinaryUtils.ReadTimestamp, 
BinaryUtils.TypeTimestamp);
+            return ReadField(fieldName, BinaryUtils.ReadTimestamp, 
BinaryTypeId.Timestamp);
         }
 
         /** <inheritdoc /> */
         public DateTime? ReadTimestamp()
         {
-            return Read(BinaryUtils.ReadTimestamp, BinaryUtils.TypeTimestamp);
+            return Read(BinaryUtils.ReadTimestamp, BinaryTypeId.Timestamp);
         }
         
         /** <inheritdoc /> */
         public DateTime?[] ReadTimestampArray(string fieldName)
         {
-            return ReadField(fieldName, BinaryUtils.ReadTimestampArray, 
BinaryUtils.TypeArrayTimestamp);
+            return ReadField(fieldName, BinaryUtils.ReadTimestampArray, 
BinaryTypeId.ArrayTimestamp);
         }
         
         /** <inheritdoc /> */
         public DateTime?[] ReadTimestampArray()
         {
-            return Read(BinaryUtils.ReadTimestampArray, 
BinaryUtils.TypeArrayTimestamp);
+            return Read(BinaryUtils.ReadTimestampArray, 
BinaryTypeId.ArrayTimestamp);
         }
         
         /** <inheritdoc /> */
         public string ReadString(string fieldName)
         {
-            return ReadField(fieldName, BinaryUtils.ReadString, 
BinaryUtils.TypeString);
+            return ReadField(fieldName, BinaryUtils.ReadString, 
BinaryTypeId.String);
         }
 
         /** <inheritdoc /> */
         public string ReadString()
         {
-            return Read(BinaryUtils.ReadString, BinaryUtils.TypeString);
+            return Read(BinaryUtils.ReadString, BinaryTypeId.String);
         }
 
         /** <inheritdoc /> */
         public string[] ReadStringArray(string fieldName)
         {
-            return ReadField(fieldName, r => BinaryUtils.ReadArray<string>(r, 
false), BinaryUtils.TypeArrayString);
+            return ReadField(fieldName, r => BinaryUtils.ReadArray<string>(r, 
false), BinaryTypeId.ArrayString);
         }
 
         /** <inheritdoc /> */
         public string[] ReadStringArray()
         {
-            return Read(r => BinaryUtils.ReadArray<string>(r, false), 
BinaryUtils.TypeArrayString);
+            return Read(r => BinaryUtils.ReadArray<string>(r, false), 
BinaryTypeId.ArrayString);
         }
 
         /** <inheritdoc /> */
         public Guid? ReadGuid(string fieldName)
         {
-            return ReadField<Guid?>(fieldName, r => BinaryUtils.ReadGuid(r), 
BinaryUtils.TypeGuid);
+            return ReadField<Guid?>(fieldName, r => BinaryUtils.ReadGuid(r), 
BinaryTypeId.Guid);
         }
 
         /** <inheritdoc /> */
         public Guid? ReadGuid()
         {
-            return Read<Guid?>(r => BinaryUtils.ReadGuid(r), 
BinaryUtils.TypeGuid);
+            return Read<Guid?>(r => BinaryUtils.ReadGuid(r), 
BinaryTypeId.Guid);
         }
 
         /** <inheritdoc /> */
         public Guid?[] ReadGuidArray(string fieldName)
         {
-            return ReadField(fieldName, r => BinaryUtils.ReadArray<Guid?>(r, 
false), BinaryUtils.TypeArrayGuid);
+            return ReadField(fieldName, r => BinaryUtils.ReadArray<Guid?>(r, 
false), BinaryTypeId.ArrayGuid);
         }
 
         /** <inheritdoc /> */
         public Guid?[] ReadGuidArray()
         {
-            return Read(r => BinaryUtils.ReadArray<Guid?>(r, false), 
BinaryUtils.TypeArrayGuid);
+            return Read(r => BinaryUtils.ReadArray<Guid?>(r, false), 
BinaryTypeId.ArrayGuid);
         }
 
         /** <inheritdoc /> */
@@ -399,10 +399,10 @@ namespace Apache.Ignite.Core.Impl.Binary
                 case BinaryUtils.HdrNull:
                     return default(T);
 
-                case BinaryUtils.TypeEnum:
+                case BinaryTypeId.Enum:
                     return ReadEnum0<T>(this, _mode == BinaryMode.ForceBinary);
 
-                case BinaryUtils.TypeBinaryEnum:
+                case BinaryTypeId.BinaryEnum:
                     return ReadEnum0<T>(this, _mode != BinaryMode.Deserialize);
 
                 case BinaryUtils.HdrFull:
@@ -414,20 +414,20 @@ namespace Apache.Ignite.Core.Impl.Binary
                 default:
                     throw new BinaryObjectException(string.Format(
                         "Invalid header on enum deserialization. Expected: {0} 
or {1} or {2} but was: {3}",
-                            BinaryUtils.TypeEnum, BinaryUtils.TypeBinaryEnum, 
BinaryUtils.HdrFull, hdr));
+                            BinaryTypeId.Enum, BinaryTypeId.BinaryEnum, 
BinaryUtils.HdrFull, hdr));
             }
         }
 
         /** <inheritdoc /> */
         public T[] ReadEnumArray<T>(string fieldName)
         {
-            return ReadField(fieldName, r => BinaryUtils.ReadArray<T>(r, 
true), BinaryUtils.TypeArrayEnum);
+            return ReadField(fieldName, r => BinaryUtils.ReadArray<T>(r, 
true), BinaryTypeId.ArrayEnum);
         }
 
         /** <inheritdoc /> */
         public T[] ReadEnumArray<T>()
         {
-            return Read(r => BinaryUtils.ReadArray<T>(r, true), 
BinaryUtils.TypeArrayEnum);
+            return Read(r => BinaryUtils.ReadArray<T>(r, true), 
BinaryTypeId.ArrayEnum);
         }
 
         /** <inheritdoc /> */
@@ -451,13 +451,13 @@ namespace Apache.Ignite.Core.Impl.Binary
         /** <inheritdoc /> */
         public T[] ReadArray<T>(string fieldName)
         {
-            return ReadField(fieldName, r => BinaryUtils.ReadArray<T>(r, 
true), BinaryUtils.TypeArray);
+            return ReadField(fieldName, r => BinaryUtils.ReadArray<T>(r, 
true), BinaryTypeId.Array);
         }
 
         /** <inheritdoc /> */
         public T[] ReadArray<T>()
         {
-            return Read(r => BinaryUtils.ReadArray<T>(r, true), 
BinaryUtils.TypeArray);
+            return Read(r => BinaryUtils.ReadArray<T>(r, true), 
BinaryTypeId.Array);
         }
 
         /** <inheritdoc /> */
@@ -476,13 +476,13 @@ namespace Apache.Ignite.Core.Impl.Binary
         public ICollection ReadCollection(string fieldName, Func<int, 
ICollection> factory, 
             Action<ICollection, object> adder)
         {
-            return ReadField(fieldName, r => BinaryUtils.ReadCollection(r, 
factory, adder), BinaryUtils.TypeCollection);
+            return ReadField(fieldName, r => BinaryUtils.ReadCollection(r, 
factory, adder), BinaryTypeId.Collection);
         }
 
         /** <inheritdoc /> */
         public ICollection ReadCollection(Func<int, ICollection> factory, 
Action<ICollection, object> adder)
         {
-            return Read(r => BinaryUtils.ReadCollection(r, factory, adder), 
BinaryUtils.TypeCollection);
+            return Read(r => BinaryUtils.ReadCollection(r, factory, adder), 
BinaryTypeId.Collection);
         }
 
         /** <inheritdoc /> */
@@ -500,13 +500,13 @@ namespace Apache.Ignite.Core.Impl.Binary
         /** <inheritdoc /> */
         public IDictionary ReadDictionary(string fieldName, Func<int, 
IDictionary> factory)
         {
-            return ReadField(fieldName, r => BinaryUtils.ReadDictionary(r, 
factory), BinaryUtils.TypeDictionary);
+            return ReadField(fieldName, r => BinaryUtils.ReadDictionary(r, 
factory), BinaryTypeId.Dictionary);
         }
 
         /** <inheritdoc /> */
         public IDictionary ReadDictionary(Func<int, IDictionary> factory)
         {
-            return Read(r => BinaryUtils.ReadDictionary(r, factory), 
BinaryUtils.TypeDictionary);
+            return Read(r => BinaryUtils.ReadDictionary(r, factory), 
BinaryTypeId.Dictionary);
         }
 
         /// <summary>
@@ -577,17 +577,17 @@ namespace Apache.Ignite.Core.Impl.Binary
 
                     return true;
 
-                case BinaryUtils.TypeBinary:
+                case BinaryTypeId.Binary:
                     res = ReadBinaryObject<T>(doDetach);
 
                     return true;
 
-                case BinaryUtils.TypeEnum:
+                case BinaryTypeId.Enum:
                     res = ReadEnum0<T>(this, _mode == BinaryMode.ForceBinary);
 
                     return true;
 
-                case BinaryUtils.TypeBinaryEnum:
+                case BinaryTypeId.BinaryEnum:
                     res = ReadEnum0<T>(this, _mode != BinaryMode.Deserialize);
 
                     return true;
@@ -716,7 +716,7 @@ namespace Apache.Ignite.Core.Impl.Binary
                 else
                 {
                     // Find descriptor.
-                    var desc = hdr.TypeId == BinaryUtils.TypeUnregistered
+                    var desc = hdr.TypeId == BinaryTypeId.Unregistered
                         ? 
_marsh.GetDescriptor(ReadUnregisteredType(typeOverride))
                         : _marsh.GetDescriptor(hdr.IsUserType, hdr.TypeId, 
true, null, typeOverride);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/55e0b5c9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
----------------------------------------------------------------------
diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
 
b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
index 95a0be3..f55a11f 100644
--- 
a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
+++ 
b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
@@ -19,7 +19,6 @@ namespace Apache.Ignite.Core.Impl.Binary
 {
     using System;
     using System.Collections;
-    using System.Collections.Generic;
     using System.Diagnostics;
     using System.Diagnostics.CodeAnalysis;
     using Apache.Ignite.Core.Impl.Binary.IO;
@@ -37,45 +36,6 @@ namespace Apache.Ignite.Core.Impl.Binary
         /** Read handlers. */
         private static readonly IBinarySystemReader[] ReadHandlers = new 
IBinarySystemReader[255];
 
-        /** Type ids. */
-        private static readonly Dictionary<Type, byte> TypeIds = new 
Dictionary<Type, byte>
-        {
-            {typeof (bool), BinaryUtils.TypeBool},
-            {typeof (byte), BinaryUtils.TypeByte},
-            {typeof (sbyte), BinaryUtils.TypeByte},
-            {typeof (short), BinaryUtils.TypeShort},
-            {typeof (ushort), BinaryUtils.TypeShort},
-            {typeof (char), BinaryUtils.TypeChar},
-            {typeof (int), BinaryUtils.TypeInt},
-            {typeof (uint), BinaryUtils.TypeInt},
-            {typeof (long), BinaryUtils.TypeLong},
-            {typeof (ulong), BinaryUtils.TypeLong},
-            {typeof (float), BinaryUtils.TypeFloat},
-            {typeof (double), BinaryUtils.TypeDouble},
-            {typeof (string), BinaryUtils.TypeString},
-            {typeof (decimal), BinaryUtils.TypeDecimal},
-            {typeof (Guid), BinaryUtils.TypeGuid},
-            {typeof (Guid?), BinaryUtils.TypeGuid},
-            {typeof (ArrayList), BinaryUtils.TypeCollection},
-            {typeof (Hashtable), BinaryUtils.TypeDictionary},
-            {typeof (bool[]), BinaryUtils.TypeArrayBool},
-            {typeof (byte[]), BinaryUtils.TypeArrayByte},
-            {typeof (sbyte[]), BinaryUtils.TypeArrayByte},
-            {typeof (short[]), BinaryUtils.TypeArrayShort},
-            {typeof (ushort[]), BinaryUtils.TypeArrayShort},
-            {typeof (char[]), BinaryUtils.TypeArrayChar},
-            {typeof (int[]), BinaryUtils.TypeArrayInt},
-            {typeof (uint[]), BinaryUtils.TypeArrayInt},
-            {typeof (long[]), BinaryUtils.TypeArrayLong},
-            {typeof (ulong[]), BinaryUtils.TypeArrayLong},
-            {typeof (float[]), BinaryUtils.TypeArrayFloat},
-            {typeof (double[]), BinaryUtils.TypeArrayDouble},
-            {typeof (string[]), BinaryUtils.TypeArrayString},
-            {typeof (decimal?[]), BinaryUtils.TypeArrayDecimal},
-            {typeof (Guid?[]), BinaryUtils.TypeArrayGuid},
-            {typeof (object[]), BinaryUtils.TypeArray}
-        };
-        
         /// <summary>
         /// Initializes the <see cref="BinarySystemHandlers"/> class.
         /// </summary>
@@ -84,75 +44,75 @@ namespace Apache.Ignite.Core.Impl.Binary
         static BinarySystemHandlers()
         {
             // 1. Primitives.
-            ReadHandlers[BinaryUtils.TypeBool] = new 
BinarySystemReader<bool>(s => s.ReadBool());
-            ReadHandlers[BinaryUtils.TypeByte] = new 
BinarySystemReader<byte>(s => s.ReadByte());
-            ReadHandlers[BinaryUtils.TypeShort] = new 
BinarySystemReader<short>(s => s.ReadShort());
-            ReadHandlers[BinaryUtils.TypeChar] = new 
BinarySystemReader<char>(s => s.ReadChar());
-            ReadHandlers[BinaryUtils.TypeInt] = new BinarySystemReader<int>(s 
=> s.ReadInt());
-            ReadHandlers[BinaryUtils.TypeLong] = new 
BinarySystemReader<long>(s => s.ReadLong());
-            ReadHandlers[BinaryUtils.TypeFloat] = new 
BinarySystemReader<float>(s => s.ReadFloat());
-            ReadHandlers[BinaryUtils.TypeDouble] = new 
BinarySystemReader<double>(s => s.ReadDouble());
-            ReadHandlers[BinaryUtils.TypeDecimal] = new 
BinarySystemReader<decimal?>(BinaryUtils.ReadDecimal);
+            ReadHandlers[BinaryTypeId.Bool] = new BinarySystemReader<bool>(s 
=> s.ReadBool());
+            ReadHandlers[BinaryTypeId.Byte] = new BinarySystemReader<byte>(s 
=> s.ReadByte());
+            ReadHandlers[BinaryTypeId.Short] = new BinarySystemReader<short>(s 
=> s.ReadShort());
+            ReadHandlers[BinaryTypeId.Char] = new BinarySystemReader<char>(s 
=> s.ReadChar());
+            ReadHandlers[BinaryTypeId.Int] = new BinarySystemReader<int>(s => 
s.ReadInt());
+            ReadHandlers[BinaryTypeId.Long] = new BinarySystemReader<long>(s 
=> s.ReadLong());
+            ReadHandlers[BinaryTypeId.Float] = new BinarySystemReader<float>(s 
=> s.ReadFloat());
+            ReadHandlers[BinaryTypeId.Double] = new 
BinarySystemReader<double>(s => s.ReadDouble());
+            ReadHandlers[BinaryTypeId.Decimal] = new 
BinarySystemReader<decimal?>(BinaryUtils.ReadDecimal);
 
             // 2. Date.
-            ReadHandlers[BinaryUtils.TypeTimestamp] = new 
BinarySystemReader<DateTime?>(BinaryUtils.ReadTimestamp);
+            ReadHandlers[BinaryTypeId.Timestamp] = new 
BinarySystemReader<DateTime?>(BinaryUtils.ReadTimestamp);
 
             // 3. String.
-            ReadHandlers[BinaryUtils.TypeString] = new 
BinarySystemReader<string>(BinaryUtils.ReadString);
+            ReadHandlers[BinaryTypeId.String] = new 
BinarySystemReader<string>(BinaryUtils.ReadString);
 
             // 4. Guid.
-            ReadHandlers[BinaryUtils.TypeGuid] = new 
BinarySystemReader<Guid?>(s => BinaryUtils.ReadGuid(s));
+            ReadHandlers[BinaryTypeId.Guid] = new BinarySystemReader<Guid?>(s 
=> BinaryUtils.ReadGuid(s));
 
             // 5. Primitive arrays.
-            ReadHandlers[BinaryUtils.TypeArrayBool] = new 
BinarySystemReader<bool[]>(BinaryUtils.ReadBooleanArray);
+            ReadHandlers[BinaryTypeId.ArrayBool] = new 
BinarySystemReader<bool[]>(BinaryUtils.ReadBooleanArray);
 
-            ReadHandlers[BinaryUtils.TypeArrayByte] =
+            ReadHandlers[BinaryTypeId.ArrayByte] =
                 new BinarySystemDualReader<byte[], 
sbyte[]>(BinaryUtils.ReadByteArray, BinaryUtils.ReadSbyteArray);
             
-            ReadHandlers[BinaryUtils.TypeArrayShort] =
+            ReadHandlers[BinaryTypeId.ArrayShort] =
                 new BinarySystemDualReader<short[], 
ushort[]>(BinaryUtils.ReadShortArray,
                     BinaryUtils.ReadUshortArray);
 
-            ReadHandlers[BinaryUtils.TypeArrayChar] = 
+            ReadHandlers[BinaryTypeId.ArrayChar] = 
                 new BinarySystemReader<char[]>(BinaryUtils.ReadCharArray);
 
-            ReadHandlers[BinaryUtils.TypeArrayInt] =
+            ReadHandlers[BinaryTypeId.ArrayInt] =
                 new BinarySystemDualReader<int[], 
uint[]>(BinaryUtils.ReadIntArray, BinaryUtils.ReadUintArray);
             
-            ReadHandlers[BinaryUtils.TypeArrayLong] =
+            ReadHandlers[BinaryTypeId.ArrayLong] =
                 new BinarySystemDualReader<long[], 
ulong[]>(BinaryUtils.ReadLongArray, 
                     BinaryUtils.ReadUlongArray);
 
-            ReadHandlers[BinaryUtils.TypeArrayFloat] =
+            ReadHandlers[BinaryTypeId.ArrayFloat] =
                 new BinarySystemReader<float[]>(BinaryUtils.ReadFloatArray);
 
-            ReadHandlers[BinaryUtils.TypeArrayDouble] =
+            ReadHandlers[BinaryTypeId.ArrayDouble] =
                 new BinarySystemReader<double[]>(BinaryUtils.ReadDoubleArray);
 
-            ReadHandlers[BinaryUtils.TypeArrayDecimal] =
+            ReadHandlers[BinaryTypeId.ArrayDecimal] =
                 new 
BinarySystemReader<decimal?[]>(BinaryUtils.ReadDecimalArray);
 
             // 6. Date array.
-            ReadHandlers[BinaryUtils.TypeArrayTimestamp] =
+            ReadHandlers[BinaryTypeId.ArrayTimestamp] =
                 new 
BinarySystemReader<DateTime?[]>(BinaryUtils.ReadTimestampArray);
 
             // 7. String array.
-            ReadHandlers[BinaryUtils.TypeArrayString] = new 
BinarySystemTypedArrayReader<string>();
+            ReadHandlers[BinaryTypeId.ArrayString] = new 
BinarySystemTypedArrayReader<string>();
 
             // 8. Guid array.
-            ReadHandlers[BinaryUtils.TypeArrayGuid] = new 
BinarySystemTypedArrayReader<Guid?>();
+            ReadHandlers[BinaryTypeId.ArrayGuid] = new 
BinarySystemTypedArrayReader<Guid?>();
 
             // 9. Array.
-            ReadHandlers[BinaryUtils.TypeArray] = new 
BinarySystemReader(ReadArray);
+            ReadHandlers[BinaryTypeId.Array] = new 
BinarySystemReader(ReadArray);
 
             // 11. Arbitrary collection.
-            ReadHandlers[BinaryUtils.TypeCollection] = new 
BinarySystemReader(ReadCollection);
+            ReadHandlers[BinaryTypeId.Collection] = new 
BinarySystemReader(ReadCollection);
 
             // 13. Arbitrary dictionary.
-            ReadHandlers[BinaryUtils.TypeDictionary] = new 
BinarySystemReader(ReadDictionary);
+            ReadHandlers[BinaryTypeId.Dictionary] = new 
BinarySystemReader(ReadDictionary);
             
             // 14. Enum.
-            ReadHandlers[BinaryUtils.TypeArrayEnum] = new 
BinarySystemReader(ReadEnumArray);
+            ReadHandlers[BinaryTypeId.ArrayEnum] = new 
BinarySystemReader(ReadEnumArray);
         }
 
         /// <summary>
@@ -266,27 +226,6 @@ namespace Apache.Ignite.Core.Impl.Binary
         }
 
         /// <summary>
-        /// Find write handler for type.
-        /// </summary>
-        /// <param name="type">Type.</param>
-        /// <returns>Write handler or NULL.</returns>
-        public static byte GetTypeId(Type type)
-        {
-            byte res;
-
-            if (TypeIds.TryGetValue(type, out res))
-                return res;
-
-            if (BinaryUtils.IsIgniteEnum(type))
-                return BinaryUtils.TypeEnum;
-
-            if (type.IsArray && 
BinaryUtils.IsIgniteEnum(type.GetElementType()))
-                return BinaryUtils.TypeArrayEnum;
-
-            return BinaryUtils.TypeObject;
-        }
-
-        /// <summary>
         /// Reads an object of predefined type.
         /// </summary>
         public static bool TryReadSystemType<T>(byte typeId, BinaryReader ctx, 
out T res)
@@ -310,7 +249,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <param name="obj">Value.</param>
         private static void WriteDecimal(BinaryWriter ctx, decimal obj)
         {
-            ctx.Stream.WriteByte(BinaryUtils.TypeDecimal);
+            ctx.Stream.WriteByte(BinaryTypeId.Decimal);
 
             BinaryUtils.WriteDecimal(obj, ctx.Stream);
         }
@@ -322,7 +261,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <param name="obj">Object.</param>
         private static void WriteString(BinaryWriter ctx, string obj)
         {
-            ctx.Stream.WriteByte(BinaryUtils.TypeString);
+            ctx.Stream.WriteByte(BinaryTypeId.String);
 
             BinaryUtils.WriteString(obj, ctx.Stream);
         }
@@ -334,7 +273,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <param name="obj">Value.</param>
         private static void WriteGuid(BinaryWriter ctx, Guid obj)
         {
-            ctx.Stream.WriteByte(BinaryUtils.TypeGuid);
+            ctx.Stream.WriteByte(BinaryTypeId.Guid);
 
             BinaryUtils.WriteGuid(obj, ctx.Stream);
         }
@@ -346,7 +285,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <param name="obj">Value.</param>
         private static void WriteBoolArray(BinaryWriter ctx, bool[] obj)
         {
-            ctx.Stream.WriteByte(BinaryUtils.TypeArrayBool);
+            ctx.Stream.WriteByte(BinaryTypeId.ArrayBool);
 
             BinaryUtils.WriteBooleanArray(obj, ctx.Stream);
         }
@@ -358,7 +297,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <param name="obj">Value.</param>
         private static void WriteByteArray(BinaryWriter ctx, byte[] obj)
         {
-            ctx.Stream.WriteByte(BinaryUtils.TypeArrayByte);
+            ctx.Stream.WriteByte(BinaryTypeId.ArrayByte);
 
             BinaryUtils.WriteByteArray(obj, ctx.Stream);
         }
@@ -370,7 +309,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <param name="obj">Value.</param>
         private static void WriteShortArray(BinaryWriter ctx, short[] obj)
         {
-            ctx.Stream.WriteByte(BinaryUtils.TypeArrayShort);
+            ctx.Stream.WriteByte(BinaryTypeId.ArrayShort);
 
             BinaryUtils.WriteShortArray(obj, ctx.Stream);
         }
@@ -382,7 +321,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <param name="obj">Value.</param>
         private static void WriteCharArray(BinaryWriter ctx, object obj)
         {
-            ctx.Stream.WriteByte(BinaryUtils.TypeArrayChar);
+            ctx.Stream.WriteByte(BinaryTypeId.ArrayChar);
 
             BinaryUtils.WriteCharArray((char[])obj, ctx.Stream);
         }
@@ -394,7 +333,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <param name="obj">Value.</param>
         private static void WriteIntArray(BinaryWriter ctx, int[] obj)
         {
-            ctx.Stream.WriteByte(BinaryUtils.TypeArrayInt);
+            ctx.Stream.WriteByte(BinaryTypeId.ArrayInt);
 
             BinaryUtils.WriteIntArray(obj, ctx.Stream);
         }
@@ -406,7 +345,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <param name="obj">Value.</param>
         private static void WriteLongArray(BinaryWriter ctx, long[] obj)
         {
-            ctx.Stream.WriteByte(BinaryUtils.TypeArrayLong);
+            ctx.Stream.WriteByte(BinaryTypeId.ArrayLong);
 
             BinaryUtils.WriteLongArray(obj, ctx.Stream);
         }
@@ -418,7 +357,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <param name="obj">Value.</param>
         private static void WriteFloatArray(BinaryWriter ctx, float[] obj)
         {
-            ctx.Stream.WriteByte(BinaryUtils.TypeArrayFloat);
+            ctx.Stream.WriteByte(BinaryTypeId.ArrayFloat);
 
             BinaryUtils.WriteFloatArray(obj, ctx.Stream);
         }
@@ -430,7 +369,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <param name="obj">Value.</param>
         private static void WriteDoubleArray(BinaryWriter ctx, double[] obj)
         {
-            ctx.Stream.WriteByte(BinaryUtils.TypeArrayDouble);
+            ctx.Stream.WriteByte(BinaryTypeId.ArrayDouble);
 
             BinaryUtils.WriteDoubleArray(obj, ctx.Stream);
         }
@@ -442,7 +381,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <param name="obj">Value.</param>
         private static void WriteDecimalArray(BinaryWriter ctx, decimal?[] obj)
         {
-            ctx.Stream.WriteByte(BinaryUtils.TypeArrayDecimal);
+            ctx.Stream.WriteByte(BinaryTypeId.ArrayDecimal);
 
             BinaryUtils.WriteDecimalArray(obj, ctx.Stream);
         }
@@ -454,7 +393,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <param name="obj">Value.</param>
         private static void WriteStringArray(BinaryWriter ctx, string[] obj)
         {
-            ctx.Stream.WriteByte(BinaryUtils.TypeArrayString);
+            ctx.Stream.WriteByte(BinaryTypeId.ArrayString);
 
             BinaryUtils.WriteStringArray(obj, ctx.Stream);
         }
@@ -466,7 +405,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <param name="obj">Value.</param>
         private static void WriteGuidArray(BinaryWriter ctx, Guid?[] obj)
         {
-            ctx.Stream.WriteByte(BinaryUtils.TypeArrayGuid);
+            ctx.Stream.WriteByte(BinaryTypeId.ArrayGuid);
 
             BinaryUtils.WriteGuidArray(obj, ctx.Stream);
         }
@@ -476,7 +415,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// </summary>
         private static void WriteEnumArray(BinaryWriter ctx, object obj)
         {
-            ctx.Stream.WriteByte(BinaryUtils.TypeArrayEnum);
+            ctx.Stream.WriteByte(BinaryTypeId.ArrayEnum);
 
             BinaryUtils.WriteArray((Array) obj, ctx);
         }
@@ -486,7 +425,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// </summary>
         private static void WriteArray(BinaryWriter ctx, object obj)
         {
-            ctx.Stream.WriteByte(BinaryUtils.TypeArray);
+            ctx.Stream.WriteByte(BinaryTypeId.Array);
 
             BinaryUtils.WriteArray((Array) obj, ctx);
         }
@@ -496,7 +435,7 @@ namespace Apache.Ignite.Core.Impl.Binary
          */
         private static void WriteArrayList(BinaryWriter ctx, ICollection obj)
         {
-            ctx.Stream.WriteByte(BinaryUtils.TypeCollection);
+            ctx.Stream.WriteByte(BinaryTypeId.Collection);
 
             BinaryUtils.WriteCollection(obj, ctx, 
BinaryUtils.CollectionArrayList);
         }
@@ -506,7 +445,7 @@ namespace Apache.Ignite.Core.Impl.Binary
          */
         private static void WriteHashtable(BinaryWriter ctx, IDictionary obj)
         {
-            ctx.Stream.WriteByte(BinaryUtils.TypeDictionary);
+            ctx.Stream.WriteByte(BinaryTypeId.Dictionary);
 
             BinaryUtils.WriteDictionary(obj, ctx, BinaryUtils.MapHashMap);
         }
@@ -516,7 +455,7 @@ namespace Apache.Ignite.Core.Impl.Binary
          */
         private static void WriteBinary(BinaryWriter ctx, BinaryObject obj)
         {
-            ctx.Stream.WriteByte(BinaryUtils.TypeBinary);
+            ctx.Stream.WriteByte(BinaryTypeId.Binary);
 
             BinaryUtils.WriteBinary(ctx.Stream, obj);
         }
@@ -528,7 +467,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         {
             var binEnum = obj;
 
-            ctx.Stream.WriteByte(BinaryUtils.TypeBinaryEnum);
+            ctx.Stream.WriteByte(BinaryTypeId.BinaryEnum);
 
             ctx.WriteInt(binEnum.TypeId);
             ctx.WriteInt(binEnum.EnumValue);

http://git-wip-us.apache.org/repos/asf/ignite/blob/55e0b5c9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryTypeId.cs
----------------------------------------------------------------------
diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryTypeId.cs 
b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryTypeId.cs
new file mode 100644
index 0000000..1d3d9c4
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryTypeId.cs
@@ -0,0 +1,228 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Impl.Binary
+{
+    using System;
+    using System.Collections;
+    using System.Collections.Generic;
+
+    /// <summary>
+    /// Binary type IDs.
+    /// </summary>
+    internal static class BinaryTypeId
+    {
+        /** Type: object. */
+        public const byte Object = BinaryUtils.HdrFull;
+
+        /** Type: unregistered. */
+        public const byte Unregistered = 0;
+
+        /** Type: unsigned byte. */
+        public const byte Byte = 1;
+
+        /** Type: short. */
+        public const byte Short = 2;
+
+        /** Type: int. */
+        public const byte Int = 3;
+
+        /** Type: long. */
+        public const byte Long = 4;
+
+        /** Type: float. */
+        public const byte Float = 5;
+
+        /** Type: double. */
+        public const byte Double = 6;
+
+        /** Type: char. */
+        public const byte Char = 7;
+
+        /** Type: boolean. */
+        public const byte Bool = 8;
+
+        /** Type: decimal. */
+        public const byte Decimal = 30;
+
+        /** Type: string. */
+        public const byte String = 9;
+
+        /** Type: GUID. */
+        public const byte Guid = 10;
+
+        /** Type: date. */
+        public const byte Timestamp = 33;
+
+        /** Type: unsigned byte array. */
+        public const byte ArrayByte = 12;
+
+        /** Type: short array. */
+        public const byte ArrayShort = 13;
+
+        /** Type: int array. */
+        public const byte ArrayInt = 14;
+
+        /** Type: long array. */
+        public const byte ArrayLong = 15;
+
+        /** Type: float array. */
+        public const byte ArrayFloat = 16;
+
+        /** Type: double array. */
+        public const byte ArrayDouble = 17;
+
+        /** Type: char array. */
+        public const byte ArrayChar = 18;
+
+        /** Type: boolean array. */
+        public const byte ArrayBool = 19;
+
+        /** Type: decimal array. */
+        public const byte ArrayDecimal = 31;
+
+        /** Type: string array. */
+        public const byte ArrayString = 20;
+
+        /** Type: GUID array. */
+        public const byte ArrayGuid = 21;
+
+        /** Type: date array. */
+        public const byte ArrayTimestamp = 34;
+
+        /** Type: object array. */
+        public const byte Array = 23;
+
+        /** Type: collection. */
+        public const byte Collection = 24;
+
+        /** Type: map. */
+        public const byte Dictionary = 25;
+
+        /** Type: binary object. */
+        public const byte Binary = 27;
+
+        /** Type: enum. */
+        public const byte Enum = 28;
+
+        /** Type: enum array. */
+        public const byte ArrayEnum = 29;
+
+        /** Type: binary enum. */
+        public const byte BinaryEnum = 38;
+
+        /** Type: native job holder. */
+        public const byte NativeJobHolder = 77;
+
+        /** Type: function wrapper. */
+        public const byte ComputeOutFuncJob = 80;
+
+        /** Type: function wrapper. */
+        public const byte ComputeFuncJob = 81;
+
+        /** Type: continuous query remote filter. */
+        public const byte ContinuousQueryRemoteFilterHolder = 82;
+
+        /** Type: Compute out func wrapper. */
+        public const byte ComputeOutFuncWrapper = 83;
+
+        /** Type: Compute func wrapper. */
+        public const byte ComputeFuncWrapper = 85;
+
+        /** Type: Compute job wrapper. */
+        public const byte ComputeJobWrapper = 86;
+
+        /** Type: action wrapper. */
+        public const byte ComputeActionJob = 88;
+
+        /** Type: entry processor holder. */
+        public const byte CacheEntryProcessorHolder = 89;
+
+        /** Type: entry predicate holder. */
+        public const byte CacheEntryPredicateHolder = 90;
+
+        /** Type: message filter holder. */
+        public const byte MessageListenerHolder = 92;
+
+        /** Type: stream receiver holder. */
+        public const byte StreamReceiverHolder = 94;
+
+        /** Type: platform object proxy. */
+        public const byte PlatformJavaObjectFactoryProxy = 99;
+
+        /** Type: platform object proxy. */
+        public const int IgniteUuid = 2018070327;
+
+        /** Type ids. */
+        private static readonly Dictionary<Type, byte> TypeIds = new 
Dictionary<Type, byte>
+        {
+            {typeof (bool), Bool},
+            {typeof (byte), Byte},
+            {typeof (sbyte), Byte},
+            {typeof (short), Short},
+            {typeof (ushort), Short},
+            {typeof (char), Char},
+            {typeof (int), Int},
+            {typeof (uint), Int},
+            {typeof (long), Long},
+            {typeof (ulong), Long},
+            {typeof (float), Float},
+            {typeof (double), Double},
+            {typeof (string), String},
+            {typeof (decimal), Decimal},
+            {typeof (Guid), Guid},
+            {typeof (Guid?), Guid},
+            {typeof (ArrayList), Collection},
+            {typeof (Hashtable), Dictionary},
+            {typeof (bool[]), ArrayBool},
+            {typeof (byte[]), ArrayByte},
+            {typeof (sbyte[]), ArrayByte},
+            {typeof (short[]), ArrayShort},
+            {typeof (ushort[]), ArrayShort},
+            {typeof (char[]), ArrayChar},
+            {typeof (int[]), ArrayInt},
+            {typeof (uint[]), ArrayInt},
+            {typeof (long[]), ArrayLong},
+            {typeof (ulong[]), ArrayLong},
+            {typeof (float[]), ArrayFloat},
+            {typeof (double[]), ArrayDouble},
+            {typeof (string[]), ArrayString},
+            {typeof (decimal?[]), ArrayDecimal},
+            {typeof (Guid?[]), ArrayGuid},
+            {typeof (object[]), Array}
+        };
+
+        /// <summary>
+        /// Get binary type id for a type.
+        /// </summary>
+        internal static byte GetTypeId(Type type)
+        {
+            byte res;
+
+            if (TypeIds.TryGetValue(type, out res))
+                return res;
+
+            if (BinaryUtils.IsIgniteEnum(type))
+                return Enum;
+
+            if (type.IsArray && 
BinaryUtils.IsIgniteEnum(type.GetElementType()))
+                return ArrayEnum;
+
+            return Object;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/55e0b5c9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
----------------------------------------------------------------------
diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs 
b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
index 91a536e..1146f35 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
@@ -47,147 +47,6 @@ namespace Apache.Ignite.Core.Impl.Binary
         /** Protocol versnion. */
         public const byte ProtoVer = 1;
 
-        /** Type: object. */
-        public const byte TypeObject = HdrFull;
-
-        /** Type: unregistered. */
-        public const byte TypeUnregistered = 0;
-
-        /** Type: unsigned byte. */
-        public const byte TypeByte = 1;
-
-        /** Type: short. */
-        public const byte TypeShort = 2;
-
-        /** Type: int. */
-        public const byte TypeInt = 3;
-
-        /** Type: long. */
-        public const byte TypeLong = 4;
-
-        /** Type: float. */
-        public const byte TypeFloat = 5;
-
-        /** Type: double. */
-        public const byte TypeDouble = 6;
-
-        /** Type: char. */
-        public const byte TypeChar = 7;
-
-        /** Type: boolean. */
-        public const byte TypeBool = 8;
-
-        /** Type: decimal. */
-        public const byte TypeDecimal = 30;
-
-        /** Type: string. */
-        public const byte TypeString = 9;
-
-        /** Type: GUID. */
-        public const byte TypeGuid = 10;
-
-        /** Type: date. */
-        public const byte TypeTimestamp = 33;
-
-        /** Type: unsigned byte array. */
-        public const byte TypeArrayByte = 12;
-
-        /** Type: short array. */
-        public const byte TypeArrayShort = 13;
-
-        /** Type: int array. */
-        public const byte TypeArrayInt = 14;
-
-        /** Type: long array. */
-        public const byte TypeArrayLong = 15;
-
-        /** Type: float array. */
-        public const byte TypeArrayFloat = 16;
-
-        /** Type: double array. */
-        public const byte TypeArrayDouble = 17;
-
-        /** Type: char array. */
-        public const byte TypeArrayChar = 18;
-
-        /** Type: boolean array. */
-        public const byte TypeArrayBool = 19;
-
-        /** Type: decimal array. */
-        public const byte TypeArrayDecimal = 31;
-
-        /** Type: string array. */
-        public const byte TypeArrayString = 20;
-
-        /** Type: GUID array. */
-        public const byte TypeArrayGuid = 21;
-
-        /** Type: date array. */
-        public const byte TypeArrayTimestamp = 34;
-
-        /** Type: object array. */
-        public const byte TypeArray = 23;
-
-        /** Type: collection. */
-        public const byte TypeCollection = 24;
-
-        /** Type: map. */
-        public const byte TypeDictionary = 25;
-
-        /** Type: binary object. */
-        public const byte TypeBinary = 27;
-
-        /** Type: enum. */
-        public const byte TypeEnum = 28;
-
-        /** Type: enum array. */
-        public const byte TypeArrayEnum = 29;
-
-        /** Type: binary enum. */
-        public const byte TypeBinaryEnum = 38;
-
-        /** Type: native job holder. */
-        public const byte TypeNativeJobHolder = 77;
-
-        /** Type: function wrapper. */
-        public const byte TypeComputeOutFuncJob = 80;
-
-        /** Type: function wrapper. */
-        public const byte TypeComputeFuncJob = 81;
-
-        /** Type: continuous query remote filter. */
-        public const byte TypeContinuousQueryRemoteFilterHolder = 82;
-
-        /** Type: Compute out func wrapper. */
-        public const byte TypeComputeOutFuncWrapper = 83;
-
-        /** Type: Compute func wrapper. */
-        public const byte TypeComputeFuncWrapper = 85;
-
-        /** Type: Compute job wrapper. */
-        public const byte TypeComputeJobWrapper = 86;
-
-        /** Type: action wrapper. */
-        public const byte TypeComputeActionJob = 88;
-
-        /** Type: entry processor holder. */
-        public const byte TypeCacheEntryProcessorHolder = 89;
-
-        /** Type: entry predicate holder. */
-        public const byte TypeCacheEntryPredicateHolder = 90;
-
-        /** Type: message filter holder. */
-        public const byte TypeMessageListenerHolder = 92;
-
-        /** Type: stream receiver holder. */
-        public const byte TypeStreamReceiverHolder = 94;
-
-        /** Type: platform object proxy. */
-        public const byte TypePlatformJavaObjectFactoryProxy = 99;
-
-        /** Type: platform object proxy. */
-        public const int TypeIgniteUuid = 2018070327;
-
         /** Collection: custom. */
         public const byte CollectionCustom = 0;
 
@@ -563,7 +422,7 @@ namespace Apache.Ignite.Core.Impl.Binary
             {
                 if (val.HasValue)
                 {
-                    stream.WriteByte(TypeTimestamp);
+                    stream.WriteByte(BinaryTypeId.Timestamp);
 
                     WriteTimestamp(val.Value, stream);
                 }
@@ -781,7 +640,7 @@ namespace Apache.Ignite.Core.Impl.Binary
             {
                 if (val != null)
                 {
-                    stream.WriteByte(TypeString);
+                    stream.WriteByte(BinaryTypeId.String);
                     WriteString(val, stream);
                 }
                 else
@@ -985,7 +844,7 @@ namespace Apache.Ignite.Core.Impl.Binary
             {
                 if (val.HasValue)
                 {
-                    stream.WriteByte(TypeDecimal);
+                    stream.WriteByte(BinaryTypeId.Decimal);
 
                     WriteDecimal(val.Value, stream);
                 }
@@ -1147,7 +1006,7 @@ namespace Apache.Ignite.Core.Impl.Binary
             {
                 if (val.HasValue)
                 {
-                    stream.WriteByte(TypeGuid);
+                    stream.WriteByte(BinaryTypeId.Guid);
 
                     WriteGuid(val.Value, stream);
                 }
@@ -1168,7 +1027,7 @@ namespace Apache.Ignite.Core.Impl.Binary
 
             IBinaryStream stream = ctx.Stream;
 
-            if (elemTypeId != null && elemTypeId != TypeUnregistered)
+            if (elemTypeId != null && elemTypeId != BinaryTypeId.Unregistered)
             {
                 stream.WriteInt(elemTypeId.Value);
             }
@@ -1183,7 +1042,7 @@ namespace Apache.Ignite.Core.Impl.Binary
 
                 stream.WriteInt(typeId);
 
-                if (typeId == TypeUnregistered)
+                if (typeId == BinaryTypeId.Unregistered)
                     ctx.WriteString(elemType.FullName);
             }
 
@@ -1229,7 +1088,7 @@ namespace Apache.Ignite.Core.Impl.Binary
             {
                 int typeId = stream.ReadInt();
 
-                if (typeId == TypeUnregistered)
+                if (typeId == BinaryTypeId.Unregistered)
                     ctx.ReadString();
             }
 

Reply via email to