我进入了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;
}
}
}
}
我在用户控件上有以下代码:
using MyDataLayer.Section1;
public class MyClass
{
protected void MyMethod
{
MyClass.MyItem oItem = new MyClass.MyItem();
oItem = MyClass.GetItem();
someLiteral.Text = oItem.Property1;
}
}
一切正常,除了进入access Property1
.intellisense只提供"Equals
、GetHashCode
、GetType
和ToString
"作为选项.当我将鼠标移到oItem.Property1
上时,Visual Studio给了我以下解释:
Member
水催化剂.第一节.我的班级.我的项目.物业1.getcannot be accessed with an instance reference, qualify it with a type name instead
我不确定这意味着什么,我在谷歌上搜索了一下,但没能找到答案.