public static int GetItemsCount(Unpacker unpacker) { if (unpacker == null) { throw new ArgumentNullException("unpacker"); } long rawItemsCount; try { rawItemsCount = unpacker.ItemsCount; } catch (InvalidOperationException ex) { throw SerializationExceptions.NewIsIncorrectStream(ex); } if (rawItemsCount > Int32.MaxValue) { throw SerializationExceptions.NewIsTooLargeCollection(); } int count = unchecked (( int )rawItemsCount); return(count); }
internal static int GetItemsCount(Unpacker unpacker) { long itemsCount; try { itemsCount = unpacker.ItemsCount; } catch (InvalidOperationException exception) { throw SerializationExceptions.NewIsIncorrectStream(exception); } if (itemsCount > 0x7fffffffL) { throw SerializationExceptions.NewIsTooLargeCollection(); } return((int)itemsCount); }
internal static int GetItemsCount(Unpacker unpacker) { long rawItemsCount; try { rawItemsCount = unpacker.ItemsCount; } catch (InvalidOperationException ex) { throw SerializationExceptions.NewIsIncorrectStream(ex); } if (rawItemsCount > Int32.MaxValue) { throw SerializationExceptions.NewIsTooLargeCollection(); } int count = unchecked (( int )rawItemsCount); return(count); }