Skip to content

Commit 73ed399

Browse files
authored
Merge pull request #259 from Uralstech/multi-targeting-netstandard
Enhance framework compatibility
2 parents 6334f25 + 4071c1f commit 73ed399

File tree

6 files changed

+10
-2
lines changed

6 files changed

+10
-2
lines changed

LLama/Common/FixedSizeQueue.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public FixedSizeQueue(int size)
4343
/// <param name="data"></param>
4444
public FixedSizeQueue(int size, IEnumerable<T> data)
4545
{
46-
#if !NETSTANDARD2_0
46+
#if NET6_0_OR_GREATER
4747
// Try to check the size without enumerating the entire IEnumerable. This may not be able to get the count,
4848
// in which case we'll have to check later
4949
if (data.TryGetNonEnumeratedCount(out var dataCount) && dataCount > size)

LLama/Extensions/DictionaryExtensions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ public static TValue GetValueOrDefault<TKey, TValue>(this IReadOnlyDictionary<TK
99
{
1010
return GetValueOrDefaultImpl(dictionary, key, defaultValue);
1111
}
12+
#elif !NET6_0_OR_GREATER && !NETSTANDARD2_1_OR_GREATER
13+
#error Target framework not supported!
1214
#endif
1315

1416
internal static TValue GetValueOrDefaultImpl<TKey, TValue>(IReadOnlyDictionary<TKey, TValue> dictionary, TKey key, TValue defaultValue)

LLama/Extensions/EncodingExtensions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ public static int GetCharCount(this Encoding encoding, ReadOnlySpan<byte> bytes)
1515
{
1616
return GetCharCountImpl(encoding, bytes);
1717
}
18+
#elif !NET6_0_OR_GREATER && !NETSTANDARD2_1_OR_GREATER
19+
#error Target framework not supported!
1820
#endif
1921

2022
internal static int GetCharsImpl(Encoding encoding, ReadOnlySpan<byte> bytes, Span<char> output)

LLama/Extensions/IEnumerableExtensions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ public static IEnumerable<T> TakeLast<T>(this IEnumerable<T> source, int count)
1010
{
1111
return TakeLastImpl(source, count);
1212
}
13+
#elif !NET6_0_OR_GREATER && !NETSTANDARD2_1_OR_GREATER
14+
#error Target framework not supported!
1315
#endif
1416

1517
internal static IEnumerable<T> TakeLastImpl<T>(IEnumerable<T> source, int count)

LLama/Extensions/KeyValuePairExtensions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,7 @@ public static void Deconstruct<TKey, TValue>(this System.Collections.Generic.Key
1919
first = pair.Key;
2020
second = pair.Value;
2121
}
22+
#elif !NET6_0_OR_GREATER && !NETSTANDARD2_1_OR_GREATER
23+
#error Target framework not supported!
2224
#endif
2325
}

LLama/Extensions/ListExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace LLama.Extensions
55
{
66
internal static class ListExtensions
77
{
8-
#if NETSTANDARD2_0
8+
#if !NET6_0_OR_GREATER
99
public static void EnsureCapacity<T>(this List<T> list, int capacity)
1010
{
1111
if (list.Capacity < capacity)

0 commit comments

Comments
 (0)