Public const string?

前端 未结 4 1349
爱一瞬间的悲伤
爱一瞬间的悲伤 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:35

    From the design perspective of your question, it seems like it could get messy fast using a single static object to contain all page references. Can you not just store it in the actual page object?

    class view2 {
        public const string PageName = "View2.xaml";
    
        ... other stuff ...
    }
    

    then call it along the lines of...

    goTo(view2.PageName);
    

提交回复
热议问题