public static ConcurrentDictionary <int, ConcurrentDictionary <byte, int?> > ReadNullableIntFieldDictionary(this ITypeReader serializer) { var result = new ConcurrentDictionary <int, ConcurrentDictionary <byte, int?> >(); try { var cnt = serializer.ReadInt(); for (int i = 0; i < cnt; i++) { var key = serializer.ReadInt(); var val = new ConcurrentDictionary <byte, int?>(); var subCnt = serializer.ReadInt(); for (int j = 0; j < subCnt; j++) { var subKey = serializer.ReadByte(); var subValue = serializer.ReadNullableInt(); val.TryAdd(subKey, subValue); } result.TryAdd(key, val); } } catch (Exception e) { throw new Exception($"Error serializing ConcurrentDictionary<int, ConcurrentDictionary<ChangeFieldIndexes, int?>>: {e}"); } return(result); }