Static Constants in C#

前端 未结 3 1084
谎友^
谎友^ 2020-12-09 14:17

I have this code;

using System;

namespace Rapido
{
    class Constants
    {
        public static const string FrameworkName = \"Rapido Framework\";
    }          


        
相关标签:
3条回答
  • 2020-12-09 15:03

    You don't need to declare it as static - public const string is enough.

    0 讨论(0)
  • 2020-12-09 15:07

    A const is already static as it cannot change between instances.

    0 讨论(0)
  • 2020-12-09 15:15
    public static class Constants
    {
        public const string FrameworkName = "Rapido Framework";
    }
    
    0 讨论(0)
提交回复
热议问题