我正在使用C#,但遇到了这个问题:
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;
}
}
}
}
我在UserControl上有以下代码:
using MyDataLayer.Section1;
public class MyClass
{
protected void MyMethod
{
MyClass.MyItem oItem = new MyClass.MyItem();
oItem = MyClass.GetItem();
someLiteral.Text = oItem.Property1;
}
}
一切正常,除非我访问Property1
。智能感知只给我“ ,和”作为选项。当我将鼠标悬停在时,Visual Studio给出了以下解释:Equals
GetHashCode
GetType
ToString
oItem.Property1
Member
MyDataLayer.Section1.MyClass.MyItem.Property1.getcannot be accessed with an instance reference, qualify it with a type name instead
我不确定这是什么意思,我做了一些谷歌搜索,但无法弄清楚。