C # alıyorum ve bu sorunu yaşıyorum:
namespace MyDataLayer
{
namespace Section1
{
public class MyClass
{
public class MyItem
{
public static string Property1{ get; set; }
}
public static MyItem GetItem()
{
MyItem theItem = new MyItem();
theItem.Property1 = "MyValue";
return theItem;
}
}
}
}
Bir UserControl bu kodu var:
using MyDataLayer.Section1;
public class MyClass
{
protected void MyMethod
{
MyClass.MyItem oItem = new MyClass.MyItem();
oItem = MyClass.GetItem();
someLiteral.Text = oItem.Property1;
}
}
Erişime gitmem dışında her şey yolunda gidiyor Property1. Intellisense sadece bana "verir Equals, GetHashCode, GetType, ve ToString" seçenekleri olarak. Fareyle üzerine geldiğimde oItem.Property1, Visual Studio bana şu açıklamayı yapar:
MemberMyDataLayer.Section1.MyClass.MyItem.Property1.getcannot be accessed with an instance reference, qualify it with a type name instead
Bunun ne anlama geldiğinden emin değilim, biraz googling yaptım ama anlayamadım.