Exemple #1
0
        public static object[] ReadHList(ReaderState reader)
        {
            var count       = reader.Read <int>();
            var elementType = Reader.ReadSerializedType(reader);
            var list        = new List <object>(ListCapacity.Clamp(count));

            ReadValuesIntoList(reader, count, elementType, list);
            var result = list.GetInternalArray();

            return(result.Length == list.Count ? result : list.ToArray());
        }
        public static object[] ReadList(ReaderState reader)
        {
            var count = reader.Read <int>();
            var list  = new List <object>(ListCapacity.Clamp(count));

            for (var i = 0; i < count; i++)
            {
                list.Add(ReadValue(reader));
            }
            var result = list.GetInternalArray();

            return(result.Length == list.Count ? result : list.ToArray());
        }
        public static IDictionary ReadDictionary(ReaderState reader)
        {
            var count  = reader.Read <int>();
            var result = new Dictionary <object, object>(ListCapacity.Clamp(count));

            for (var i = 0; i < count; i++)
            {
                var key   = ReadValue(reader);
                var value = ReadValue(reader);
                result.Add(key, value);
            }
            return(result);
        }
Exemple #4
0
 public static int Main()
 {
     ListCapacity ListCapacity = new ListCapacity();
     TestLibrary.TestFramework.BeginTestCase("ListCapacity");
     if (ListCapacity.RunTests())
     {
         TestLibrary.TestFramework.EndTestCase();
         TestLibrary.TestFramework.LogInformation("PASS");
         return 100;
     }
     else
     {
         TestLibrary.TestFramework.EndTestCase();
         TestLibrary.TestFramework.LogInformation("FAIL");
         return 0;
     }
 }
Exemple #5
0
    public static int Main()
    {
        ListCapacity ListCapacity = new ListCapacity();

        TestLibrary.TestFramework.BeginTestCase("ListCapacity");
        if (ListCapacity.RunTests())
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("PASS");
            return(100);
        }
        else
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("FAIL");
            return(0);
        }
    }
Exemple #6
0
 private static object CreateDictionaryResultObject(Type type, int count) => GetDictionaryResultObjectCreator(type).Create(ListCapacity.Clamp(count));
Exemple #7
0
 private static object CreateDictionaryResultObject <T>(int count)
 {
     return(DictionaryResultObjectCreator <T> .Creator.Create(ListCapacity.Clamp(count)));
 }
Exemple #8
0
 private static object CreateResultObject <T>(int count) => ListResultObjectCreator <T> .Creator.Create(ListCapacity.Clamp(count));