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

@@ -97,7 +97,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (visibilityOption == MapVisibility.Shellmap && !map.Visibility.HasFlag(visibilityOption))
continue;
var checkbox = (CheckboxWidget)visOptionTemplate.Clone();
var checkbox = visOptionTemplate.Clone();
checkbox.GetText = () => visibilityOption.ToString();
checkbox.IsChecked = () => map.Visibility.HasFlag(visibilityOption);
checkbox.OnClick = () => map.Visibility ^= visibilityOption;