Public const string?

前端 未结 4 1348
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-05 04:48

Is it ok to use a class like this (design / guideline specific)? I\'m using MVVM Pattern.

public static class Pages
{
    public const string Home = \"Home.xaml\         


        
4条回答
  •  一个人的身影
    2021-02-05 05:34

    A general guideline when using const for defining constant values. Whether these constants are to be accessed outside assembly? If not then declare it as

    internal static class Pages
    {
        public const string Home = "Home.xaml";
        public const string View2 = "View2.xaml";
        /* a few more... */
    }
    

提交回复
热议问题