Skip to content

Commit 89ba23b

Browse files
authored
Remove netstandard phase one (#4145)
* Remove netstandard phase one * Fix reordeing using * Remove directives
1 parent 715bb20 commit 89ba23b

File tree

23 files changed

+10
-194
lines changed

23 files changed

+10
-194
lines changed

src/Directory.Build.props

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,4 @@
3636
<None Include="../../.neo/README.md" Pack="true" Visible="false" PackagePath=""/>
3737
</ItemGroup>
3838

39-
<ItemGroup>
40-
<Compile Include="$(MSBuildThisFileDirectory)IsExternalInit.cs" Visible="false" />
41-
</ItemGroup>
42-
4339
</Project>

src/IsExternalInit.cs

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/Neo.ConsoleService/Neo.ConsoleService.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.1;net9.0</TargetFrameworks>
4+
<TargetFramework>net9.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
</PropertyGroup>
77

src/Neo.Cryptography.BLS12_381/Neo.Cryptography.BLS12_381.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<VersionPrefix>0.3.0</VersionPrefix>
5-
<TargetFrameworks>netstandard2.1;net9.0</TargetFrameworks>
5+
<TargetFramework>net9.0</TargetFramework>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
</PropertyGroup>

src/Neo.Extensions/BigIntegerExtensions.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@ public static int GetLowestSetBit(this BigInteger value)
4040
{
4141
if (value.Sign == 0) return -1; // special case for zero. TrailingZeroCount returns 32 in standard library.
4242

43-
#if NET7_0_OR_GREATER
4443
return (int)BigInteger.TrailingZeroCount(value);
45-
#else
46-
return TrailingZeroCount(value.ToByteArray());
47-
#endif
4844
}
4945

5046
/// <summary>
@@ -179,11 +175,7 @@ internal static BigInteger GetLowPart(this BigInteger value, int bitCount)
179175
[MethodImpl(MethodImplOptions.AggressiveInlining)]
180176
public static long GetBitLength(this BigInteger value)
181177
{
182-
#if NET5_0_OR_GREATER
183178
return value.GetBitLength();
184-
#else
185-
return BitLength(value);
186-
#endif
187179
}
188180

189181
/// <summary>

src/Neo.Extensions/ByteExtensions.cs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,7 @@ public static string ToHexString(this byte[]? value)
5757
if (value is null)
5858
throw new ArgumentNullException(nameof(value));
5959

60-
#if NET9_0_OR_GREATER
6160
return Convert.ToHexStringLower(value);
62-
#else
63-
return string.Create(value.Length * 2, value, (span, bytes) =>
64-
{
65-
for (var i = 0; i < bytes.Length; i++)
66-
{
67-
var b = bytes[i];
68-
span[i * 2] = s_hexChars[b >> 4];
69-
span[i * 2 + 1] = s_hexChars[b & 0xF];
70-
}
71-
});
72-
#endif
7361
}
7462

7563
/// <summary>
@@ -107,19 +95,7 @@ public static string ToHexString(this byte[]? value, bool reverse = false)
10795
[MethodImpl(MethodImplOptions.AggressiveInlining)]
10896
public static string ToHexString(this ReadOnlySpan<byte> value)
10997
{
110-
#if NET9_0_OR_GREATER
11198
return Convert.ToHexStringLower(value);
112-
#else
113-
// string.Create with ReadOnlySpan<char> not supported in NET5 or lower
114-
var sb = new StringBuilder(value.Length * 2);
115-
for (var i = 0; i < value.Length; i++)
116-
{
117-
var b = value[i];
118-
sb.Append(s_hexChars[b >> 4]);
119-
sb.Append(s_hexChars[b & 0xF]);
120-
}
121-
return sb.ToString();
122-
#endif
12399
}
124100

125101
/// <summary>
@@ -138,15 +114,7 @@ public static string ToHexString(this ReadOnlySpan<byte> value)
138114
[MethodImpl(MethodImplOptions.AggressiveInlining)]
139115
public static bool NotZero(this ReadOnlySpan<byte> x)
140116
{
141-
#if NET7_0_OR_GREATER
142117
return x.IndexOfAnyExcept((byte)0) >= 0;
143-
#else
144-
for (var i = 0; i < x.Length; i++)
145-
{
146-
if (x[i] != 0) return true;
147-
}
148-
return false;
149-
#endif
150118
}
151119
}
152120
}

src/Neo.Extensions/Neo.Extensions.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.1;net9.0</TargetFrameworks>
4+
<TargetFramework>net9.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
77
<PackageTags>NEO;Blockchain;Extensions</PackageTags>

src/Neo.Extensions/StringExtensions.cs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,9 @@
1010
// modifications are permitted.
1111

1212
using System;
13+
using System.Diagnostics.CodeAnalysis;
1314
using System.Runtime.CompilerServices;
1415
using System.Text;
15-
using System.Diagnostics.CodeAnalysis;
16-
17-
#if !NET9_0_OR_GREATER
18-
using System.Globalization;
19-
#endif
2016

2117
namespace Neo.Extensions
2218
{
@@ -145,18 +141,7 @@ public static byte[] HexToBytesReversed(this ReadOnlySpan<char> value)
145141
/// <returns>The converted byte array.</returns>
146142
public static byte[] HexToBytes(this ReadOnlySpan<char> value)
147143
{
148-
#if !NET9_0_OR_GREATER
149-
if (value.IsEmpty)
150-
return [];
151-
if (value.Length % 2 == 1)
152-
throw new FormatException($"value.Length({value.Length}) not multiple of 2");
153-
var result = new byte[value.Length / 2];
154-
for (var i = 0; i < result.Length; i++)
155-
result[i] = byte.Parse(value.Slice(i * 2, 2), NumberStyles.AllowHexSpecifier);
156-
return result;
157-
#else
158144
return Convert.FromHexString(value);
159-
#endif
160145
}
161146

162147
/// <summary>

src/Neo.IO/Caching/Cache.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,7 @@ public void Unlink()
7474
}
7575

7676
protected CacheItem Head { get; } = new(default!, default!);
77-
78-
#if NET9_0_OR_GREATER
7977
private readonly Lock _lock = new();
80-
#else
81-
private readonly object _lock = new();
82-
#endif
8378

8479
private readonly Dictionary<TKey, CacheItem> _innerDictionary = new(comparer);
8580

src/Neo.IO/Neo.IO.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.1;net9.0</TargetFrameworks>
4+
<TargetFramework>net9.0</TargetFramework>
55
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
66
<Nullable>enable</Nullable>
77
<PackageTags>NEO;Blockchain;IO</PackageTags>

0 commit comments

Comments
 (0)