Skip to content

Commit af7440d

Browse files
committed
fix(cache): correct array initialization syntax for compatibility
Fixed compilation error in cache array initialization. **Problem:** Cannot use array size specifier with collection initializer syntax: **Solution:** Use proper array initializer syntax: Also changed from target-typed to explicit for better compatibility across C# versions. Fixes build error in CI.
1 parent 3932d63 commit af7440d

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

src/Nino.Core/NinoDeserializer.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -208,19 +208,19 @@ private struct CacheEntryRef
208208
// Inline cache for polymorphic deserialization (4 entries per type, separate for out/ref)
209209
// Reduced from 8 to 4 for better cache locality with single array access
210210
// Shared across threads - benign races on cache updates are acceptable
211-
internal static readonly CacheEntry[] Cache = new CacheEntry[4]
211+
internal static readonly CacheEntry[] Cache = new CacheEntry[]
212212
{
213-
new() { TypeId = int.MinValue },
214-
new() { TypeId = int.MinValue },
215-
new() { TypeId = int.MinValue },
216-
new() { TypeId = int.MinValue }
213+
new CacheEntry { TypeId = int.MinValue },
214+
new CacheEntry { TypeId = int.MinValue },
215+
new CacheEntry { TypeId = int.MinValue },
216+
new CacheEntry { TypeId = int.MinValue }
217217
};
218-
internal static readonly CacheEntryRef[] CacheRef = new CacheEntryRef[4]
218+
internal static readonly CacheEntryRef[] CacheRef = new CacheEntryRef[]
219219
{
220-
new() { TypeId = int.MinValue },
221-
new() { TypeId = int.MinValue },
222-
new() { TypeId = int.MinValue },
223-
new() { TypeId = int.MinValue }
220+
new CacheEntryRef { TypeId = int.MinValue },
221+
new CacheEntryRef { TypeId = int.MinValue },
222+
new CacheEntryRef { TypeId = int.MinValue },
223+
new CacheEntryRef { TypeId = int.MinValue }
224224
};
225225

226226
public static void SetDeserializer(int typeId, DeserializeDelegate<T> deserializer,

0 commit comments

Comments
 (0)