我有这个代码;
using System;
namespace Rapido
{
class Constants
{
public static const string FrameworkName = "Rapido Framework";
}
}
Run Code Online (Sandbox Code Playgroud)
Visual Studio告诉我: The constant 'Rapido.Constants.FrameworkName' cannot be marked static
如何在不创建新实例的情况下从其他类中获取此常量?(即通过直接访问它Rapido.Constants.FrameworkName
)
Mit*_*eat 117
public static class Constants
{
public const string FrameworkName = "Rapido Framework";
}
Run Code Online (Sandbox Code Playgroud)
ggf*_*416 31
const已经是静态的,因为它不能在实例之间更改.