Saya masuk ke C # dan saya mengalami masalah ini:
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;
}
}
}
}
Saya memiliki kode ini di UserControl:
using MyDataLayer.Section1;
public class MyClass
{
protected void MyMethod
{
MyClass.MyItem oItem = new MyClass.MyItem();
oItem = MyClass.GetItem();
someLiteral.Text = oItem.Property1;
}
}
Semuanya berfungsi dengan baik, kecuali ketika saya pergi ke akses Property1. IntelliSense hanya memberi saya " , , dan " sebagai pilihan. Ketika saya mengarahkan mouse ke atas , Visual Studio memberi saya penjelasan ini:EqualsGetHashCodeGetTypeToStringoItem.Property1
MemberMyDataLayer.Section1.MyClass.MyItem.Property1.getcannot be accessed with an instance reference, qualify it with a type name instead
Saya tidak yakin apa artinya ini, saya melakukan beberapa pencarian di Google tetapi tidak dapat mengetahuinya.