Skip to content

Commit 3feb5b3

Browse files
Merge pull request #7 from GeoJSON-Net/feature/only-net-standard20
Feature/only net standard20
2 parents e00a536 + 0dfb25c commit 3feb5b3

File tree

14 files changed

+34
-29
lines changed

14 files changed

+34
-29
lines changed

.github/workflows/ci-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
build:
2020

2121
name: 'Build and Test'
22-
runs-on: windows-latest
22+
runs-on: windows-2019
2323

2424
env:
2525
VSTEST_CONNECTION_TIMEOUT: 900

.github/workflows/continous-benchmark.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
jobs:
77
benchmark:
88
name: Continuous benchmarking
9-
runs-on: ubuntu-latest
9+
runs-on: windows-2019
1010

1111
defaults:
1212
run:

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
deploy:
2121
name: 'Deploy to Nuget'
2222
if: github.event_name == 'release'
23-
runs-on: ubuntu-latest
23+
runs-on: windows-2019
2424

2525
steps:
2626
- uses: actions/checkout@v2

src/GeoJSON.Text.Test.Benchmark/SerializeAndDeserialize.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ public class SerializeAndDeserialize
1111
string fileContents = "";
1212

1313
// GeoJson.NET
14-
private Net.Feature.FeatureCollection featureCollectionGeoJsonNET = new Net.Feature.FeatureCollection();
14+
private readonly Net.Feature.FeatureCollection featureCollectionGeoJsonNET = new Net.Feature.FeatureCollection();
1515

1616
// GeoJson.Text
17-
private Text.Feature.FeatureCollection featureCollectionGeoJsonTEXT = new Text.Feature.FeatureCollection();
17+
private readonly Text.Feature.FeatureCollection featureCollectionGeoJsonTEXT = new Text.Feature.FeatureCollection();
1818

1919
[Params(1000, 10000)]
2020
public int N;

src/GeoJSON.Text.Test.Unit/Feature/FeatureTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ public void Feature_Equals_All_Geometry_Null_Issue115()
462462
}
463463

464464

465-
private IGeometryObject GetGeometry()
465+
private static IGeometryObject GetGeometry()
466466
{
467467
var coordinates = new List<LineString>
468468
{

src/GeoJSON.Text/Converters/PositionEnumerableConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace GeoJSON.Text.Converters
1414
/// </summary>
1515
public class PositionEnumerableConverter : JsonConverter<IReadOnlyCollection<IPosition>>
1616
{
17-
private static readonly PositionConverter PositionConverter = new PositionConverter();
17+
private static readonly PositionConverter PositionConverter = new();
1818

1919
/// <summary>
2020
/// Determines whether this instance can convert the specified object type.

src/GeoJSON.Text/Feature/Feature.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public TProps Properties {
143143
/// <returns></returns>
144144
public bool Equals(Feature<TGeometry, TProps> other)
145145
{
146-
if (ReferenceEquals(null, other)) return false;
146+
if (other is null) return false;
147147
if (ReferenceEquals(this, other)) return true;
148148
return base.Equals(other)
149149
&& string.Equals(Id, other.Id)
@@ -153,7 +153,7 @@ public bool Equals(Feature<TGeometry, TProps> other)
153153

154154
public override bool Equals(object obj)
155155
{
156-
if (ReferenceEquals(null, obj)) return false;
156+
if (obj is null) return false;
157157
if (ReferenceEquals(this, obj)) return true;
158158
if (obj.GetType() != GetType()) return false;
159159
return Equals((Feature<TGeometry, TProps>) obj);
@@ -271,7 +271,7 @@ private static Dictionary<string, object> GetDictionaryOfPublicProperties(object
271271

272272
public bool Equals(Feature<TGeometry> other)
273273
{
274-
if (ReferenceEquals(null, other)) return false;
274+
if (other is null) return false;
275275
if (ReferenceEquals(this, other)) return true;
276276

277277
if (Geometry == null && other.Geometry == null)
@@ -294,7 +294,7 @@ public bool Equals(Feature<TGeometry> other)
294294

295295
public override bool Equals(object obj)
296296
{
297-
if (ReferenceEquals(null, obj)) return false;
297+
if (obj is null) return false;
298298
if (ReferenceEquals(this, obj)) return true;
299299
return obj.GetType() == GetType() && Equals((Feature<TGeometry>) obj);
300300
}
@@ -306,12 +306,12 @@ public override int GetHashCode()
306306

307307
public static bool operator ==(Feature<TGeometry> left, Feature<TGeometry> right)
308308
{
309-
return left?.Equals(right) ?? ReferenceEquals(null, right);
309+
return left?.Equals(right) ?? right is null;
310310
}
311311

312312
public static bool operator !=(Feature<TGeometry> left, Feature<TGeometry> right)
313313
{
314-
return !(left?.Equals(right) ?? ReferenceEquals(null, right));
314+
return !(left?.Equals(right) ?? right is null);
315315
}
316316
}
317317
}

src/GeoJSON.Text/GeoJSON.Text.csproj

Lines changed: 6 additions & 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.0;net5;net6</TargetFrameworks>
4+
<TargetFrameworks>netstandard2.0</TargetFrameworks>
55
<LangVersion>Latest</LangVersion>
66
<Description>.Net types for the GeoJSON RFC to be used with System.Text.Json</Description>
77
<Authors>Matt Hunt</Authors>
@@ -15,6 +15,7 @@
1515
<PackageTags>geojson;geo;json;geolocation</PackageTags>
1616
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1717
<PackageReleaseNotes></PackageReleaseNotes>
18+
<EnableNETAnalyzers>true</EnableNETAnalyzers>
1819

1920
<IncludeSymbols>true</IncludeSymbols>
2021
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
@@ -31,6 +32,10 @@
3132
</PropertyGroup>
3233

3334
<ItemGroup>
35+
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0">
36+
<PrivateAssets>all</PrivateAssets>
37+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
38+
</PackageReference>
3439
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
3540
<PackageReference Include="System.Text.Json" Version="6.0.1" />
3641
</ItemGroup>

src/GeoJSON.Text/GeoJSONObject.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace GeoJSON.Text
1515
/// </summary>
1616
public abstract class GeoJSONObject : IGeoJSONObject, IEqualityComparer<GeoJSONObject>, IEquatable<GeoJSONObject>
1717
{
18-
internal static readonly DoubleTenDecimalPlaceComparer DoubleComparer = new DoubleTenDecimalPlaceComparer();
18+
internal static readonly DoubleTenDecimalPlaceComparer DoubleComparer = new();
1919

2020
/// <summary>
2121
/// Gets or sets the (optional)
@@ -86,7 +86,7 @@ public bool Equals(GeoJSONObject left, GeoJSONObject right)
8686
{
8787
return true;
8888
}
89-
if (ReferenceEquals(null, right))
89+
if (right is null)
9090
{
9191
return false;
9292
}
@@ -101,8 +101,8 @@ public bool Equals(GeoJSONObject left, GeoJSONObject right)
101101
return false;
102102
}
103103

104-
var leftIsNull = ReferenceEquals(null, left.BoundingBoxes);
105-
var rightIsNull = ReferenceEquals(null, right.BoundingBoxes);
104+
var leftIsNull = left.BoundingBoxes is null;
105+
var rightIsNull = right.BoundingBoxes is null;
106106
var bothAreMissing = leftIsNull && rightIsNull;
107107

108108
if (bothAreMissing || leftIsNull != rightIsNull)
@@ -122,7 +122,7 @@ public bool Equals(GeoJSONObject left, GeoJSONObject right)
122122
{
123123
return true;
124124
}
125-
if (ReferenceEquals(null, right))
125+
if (right is null)
126126
{
127127
return false;
128128
}

src/GeoJSON.Text/Geometry/GeometryCollection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class GeometryCollection : GeoJSONObject, IGeometryObject, IEqualityCompa
2020
/// <summary>
2121
/// Initializes a new instance of the <see cref="GeometryCollection" /> class.
2222
/// </summary>
23-
public GeometryCollection() : this(new IGeometryObject[0])
23+
public GeometryCollection() : this(Array.Empty<IGeometryObject>())
2424
{
2525
}
2626

@@ -85,7 +85,7 @@ public bool Equals(GeometryCollection left, GeometryCollection right)
8585
{
8686
return true;
8787
}
88-
if (ReferenceEquals(null, right))
88+
if (right is null)
8989
{
9090
return false;
9191
}

0 commit comments

Comments
 (0)