private static int CalculateSize(Type value) { if (value == null) { return(SerializedSizeCalculatorHelper <Guid, SerializedSizeCalculator> .CalculateSerializedSize(Guid.Empty)); } if (value.IsArray) { int num = SerializedSizeCalculatorHelper <Guid, SerializedSizeCalculator> .CalculateSerializedSize(SerializedSizeCalculator.arrayGuid); num += SerializedSizeCalculator.CalculateSize(value.GetElementType()); return(num + SerializedSizeCalculator.CalculateSizeCount(value.Name.EndsWith("[]") ? 0 : value.GetArrayRank())); } if (value.IsGenericType) { int num2 = SerializedSizeCalculatorHelper <Guid, SerializedSizeCalculator> .CalculateSerializedSize(value.GetGenericTypeDefinition().GUID); foreach (Type value2 in value.GetGenericArguments()) { num2 += SerializedSizeCalculator.CalculateSize(value2); } return(num2); } return(SerializedSizeCalculatorHelper <Guid, SerializedSizeCalculator> .CalculateSerializedSize(value.GUID)); }
private static int CalculateSize(ICollection <Type> values) { if (values == null) { return(1); } int num = SerializedSizeCalculator.CalculateSizeCount(values.Count + 1); foreach (Type value in values) { num += SerializedSizeCalculator.CalculateSize(value); } return(num); }
private static int CalculateSize(IList <Type> value) { if (value == null) { return(1); } int num = SerializedSizeCalculator.CalculateSizeCount(value.Count + 1); int i = 0; int count = value.Count; while (i < count) { num += SerializedSizeCalculator.CalculateSize(value[i]); i++; } return(num); }