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:
RoosterDragon
2024-09-21 12:08:15 +01:00
committed by Gustas
parent 9c568aba33
commit aa121dcb2f
54 changed files with 60 additions and 62 deletions

View File

@@ -9,8 +9,6 @@
*/
#endregion
using OpenRA.Widgets;
namespace OpenRA.Mods.Common.Widgets
{
public class PasswordFieldWidget : TextFieldWidget
@@ -20,6 +18,6 @@ namespace OpenRA.Mods.Common.Widgets
: base(widget) { }
protected override string GetApparentText() { return new string('*', Text.Length); }
public override Widget Clone() { return new PasswordFieldWidget(this); }
public override PasswordFieldWidget Clone() { return new PasswordFieldWidget(this); }
}
}