private ReadDelegate GetReader(System.Type type)
        {
            ReadDelegate d;

            if (!Readers.TryGetValue(type, out d))
            {
                System.Type ilist;
                System.Type idictionary;
                if (type.IsArray)
                {
                    var reader = new ArrayReader(type);
                    d = reader.Read;
                }
                else if ((ilist = type.GetInterface("System.Collections.Generic.IList`1")) != null)
                {
                    var reader = new ListReader(type, ilist.GetGenericArguments());
                    d = reader.Read;
                }
                else if ((idictionary = type.GetInterface("System.Collections.Generic.IDictionary`2")) != null)
                {
                    var reader = new DictionaryReader(type, idictionary.GetGenericArguments());
                    d = reader.Read;
                }
                else if (!type.IsPrimitive)                 // handle user defined types
                {
                    d = CreateUserDefinedReader(ref type);
                }
                else
                {
                    throw new UnsupportedPrimitiveTypeException(type);
                }
                Readers[type] = d;
            }
            return(d);
        }
		private ReadDelegate GetReader(System.Type type)
		{
			ReadDelegate d;
			if (!Readers.TryGetValue(type, out d))
			{
				System.Type ilist;
				System.Type idictionary;
				if (type.IsArray)
				{
					var reader = new ArrayReader(type);
					d = reader.Read;
				}
				else if ((ilist = type.GetInterface("System.Collections.Generic.IList`1")) != null)
				{
					var reader = new ListReader(type, ilist.GetGenericArguments());
					d = reader.Read;
				}
				else if ((idictionary = type.GetInterface("System.Collections.Generic.IDictionary`2")) != null)
				{
					var reader = new DictionaryReader(type, idictionary.GetGenericArguments());
					d = reader.Read;
				}
				else if (!type.IsPrimitive) // handle user defined types
				{
					d = CreateUserDefinedReader(ref type);
				}
				else
				{
					throw new UnsupportedPrimitiveTypeException(type);
				}
				Readers[type] = d;
			}
			return d;
		}