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); }
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; } }
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); } }
private static object CreateDictionaryResultObject(Type type, int count) => GetDictionaryResultObjectCreator(type).Create(ListCapacity.Clamp(count));
private static object CreateDictionaryResultObject <T>(int count) { return(DictionaryResultObjectCreator <T> .Creator.Create(ListCapacity.Clamp(count))); }
private static object CreateResultObject <T>(int count) => ListResultObjectCreator <T> .Creator.Create(ListCapacity.Clamp(count));