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'(ResourcePolicyAvailSystemsLVI.m_nullString="None"),,but now i am getting an error
'Ship.Controls.ResourcePolicySystemsControl.ResourcePolicyAvailSystemsLVI.m_nullString' is inaccessible due to its protection level F:\test\Ship\Controls\ResourcePolicySystemsControl.cs 81 70 Ship.Controls
protected override void OnUpdate()
{
string func = "ResourcePolicySystemsLVI.OnUpdate";
try
{
if(Data != null)
{
Text = base.Data.Name;
if(SubItems.Count == 1)
{
if (Data.WrmVersion == null)
{
SubItems.Add(ResourcePolicyAvailSystemsLVI.m_nullString);
}
else
**SubItems.Add(((IResourcePolicy)Data).WrmVersion.ToString());**
SubItems.Add(((IResourcePolicy)Data).ResourcePolicyEnabled.ToString());
SubItems.Add(((IResourcePolicy)Data).ResourcePolicyCurrent.ToString());
//SubItems.Add(((IResourcePolicy)Data).WrmVersion.ToString());
//SubItems.Add(Registry.GetValue(@"HKEY_LOCAL_MACHINE\Software\Unisys\Single Point Operations Windows Resource Monitor", "CurrentVersion", "0").ToString());
}
else
{
SubItems[1].Text = ((IResourcePolicy)Data).ResourcePolicyEnabled.ToString();
SubItems[2].Text = ((IResourcePolicy)Data).ResourcePolicyCurrent.ToString();
}
}
base.OnUpdate();
Best Answer
Well, what is the protection level of
ResourcePolicyAvailSystemsLVI.m_nullString
? And where is your code in relation? It will be inaccessible if, for exampleprivate
and you're in an unrelated classprotected
and you're not in a subclassinternal
and you're in a different assembly without [InternalsVisibleTo]
protected internal
and both of the two above applyTo 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 forResourcePolicyAvailSystemsLVI.NullString
or similar (in intellisense / object-browser).Re your comment; you have:
so just add:
and change your calling code to use
ResourcePolicyAvailSystemsLVI.NullString
.