inaccessible due to its protection level

后端 未结 2 1764
旧时难觅i
旧时难觅i 2021-01-21 18:54

i am displaying version(WrmVersion) value in a listview ,,but here i given one codition means if version(WrmVersion) is null i am displaying \'None\'(ResourcePolicyAvailSystems

2条回答
  •  生来不讨喜
    2021-01-21 19:14

    Well, what is the protection level of ResourcePolicyAvailSystemsLVI.m_nullString ? And where is your code in relation? It will be inaccessible if, for example

    • it is private and you're in an unrelated class
    • it is protected and you're not in a subclass
    • it is internal and you're in a different assembly without [InternalsVisibleTo]
    • it is protected internal and both of the two above apply

    To be honest, it looks like a field, and fields generally aren't public - so it wouldn't amaze me if somebody has changed the accessibility, perhaps adding a public static property to wrap it - or simply changed the name (although that would give a different error). Try looking for ResourcePolicyAvailSystemsLVI.NullString or similar (in intellisense / object-browser).


    Re your comment; you have:

    private static string m_nullString =
        Managers.ControlStrings.GetString("ManagedDeviceWizard.None");
    

    so just add:

    public static string NullString {get {return m_nullString;}}
    

    and change your calling code to use ResourcePolicyAvailSystemsLVI.NullString.

提交回复
热议问题