Change to use pattern matching

This commit is contained in:
teinarss
2021-02-28 19:00:32 +01:00
committed by reaperrr
parent 7c0e4b25ae
commit d60c05eff3
35 changed files with 63 additions and 122 deletions

View File

@@ -131,8 +131,7 @@ namespace OpenRA.Primitives
{
var offset = 0L;
overallBaseStream = stream;
var segmentStream = stream as SegmentStream;
if (segmentStream != null)
if (stream is SegmentStream segmentStream)
offset += segmentStream.BaseOffset + GetOverallNestedOffset(segmentStream.BaseStream, out overallBaseStream);
return offset;
}

View File

@@ -55,8 +55,7 @@ namespace OpenRA
public override bool Equals(object obj)
{
var o = obj as float3?;
return o != null && o == this;
return obj is float3 o && (float3?)o == this;
}
public override string ToString() { return "{0},{1},{2}".F(X, Y, Z); }