问题描述
这是我想要做的:
public static partial class Const
{
public static class IconColors
{
public const Color IconBlue1 = Color.FromHex("007AFF");
}
}
有人有什么建议/建议吗?
解决方法
你可以像下面这样定义
public class IconColors
{
public static Color IconBlue1 { get; } = Color.FromHex("007AFF");
}
并像访问它一样
var color = IconColors.IconBlue1;