Use covariant return types.
Use the covariant return type feature of C# 9 to allow method overrides to be more specific about their return type. By exposing this information, e.g. for Widget.Clone(), callers will have more information. This allows various casts to be removed as the information is now available within the type system.
This commit is contained in:
@@ -600,6 +600,6 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
Game.Renderer.DisableScissor();
|
||||
}
|
||||
|
||||
public override Widget Clone() { return new TextFieldWidget(this); }
|
||||
public override TextFieldWidget Clone() { return new TextFieldWidget(this); }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user