Skip to content

Commit bc7434d

Browse files
committed
Npgsql: Mitigate warnings (chore)
1 parent 86bb76f commit bc7434d

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

by-language/csharp-npgsql/BasicPoco.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ public class BasicPoco
66
public string? name { get; set; }
77
public int? age { get; set; }
88

9-
public override bool Equals(object obj)
9+
public override bool Equals(object? obj)
1010
{
11-
var other = (BasicPoco) obj;
12-
return name == other.name && age == other.age;
11+
var other = (BasicPoco?) obj;
12+
return name == other?.name && age == other?.age;
1313
}
1414

1515
public override int GetHashCode()

by-language/csharp-npgsql/DemoTypes.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ INSERT INTO testdrive.example (
426426

427427
}
428428

429-
public async Task<Point> GeoJsonTypesExample()
429+
public async Task<Point?> GeoJsonTypesExample()
430430
{
431431
Console.WriteLine("Running GeoJsonTypesExample");
432432

@@ -444,7 +444,7 @@ public async Task<Point> GeoJsonTypesExample()
444444
// Currently, `InsertGeoJsonTyped` does not work yet.
445445
var obj = reader.GetFieldValue<JsonDocument>("geoshape");
446446
var geoJsonObject = JsonConvert.DeserializeObject<Point>(obj.RootElement.ToString());
447-
return (Point) geoJsonObject;
447+
return (Point?) geoJsonObject;
448448
}
449449
}
450450

by-language/csharp-npgsql/tests/DemoProgramTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ public async Task TestGeoJsonTypesExample()
223223

224224
// Validate the outcome.
225225
var coords = new Point(new Position(85.43, 66.23)).Coordinates;
226-
Assert.Equal(coords.Latitude, point.Coordinates.Latitude);
227-
Assert.Equal(coords.Longitude, point.Coordinates.Longitude);
226+
Assert.Equal(coords.Latitude, point?.Coordinates.Latitude);
227+
Assert.Equal(coords.Longitude, point?.Coordinates.Longitude);
228228

229229
}
230230

0 commit comments

Comments
 (0)