Wchodzę w C # i mam ten problem:
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;
}
}
}
}
Mam ten kod na UserControl:
using MyDataLayer.Section1;
public class MyClass
{
protected void MyMethod
{
MyClass.MyItem oItem = new MyClass.MyItem();
oItem = MyClass.GetItem();
someLiteral.Text = oItem.Property1;
}
}
Wszystko działa dobrze, z wyjątkiem sytuacji, gdy idę do dostępu Property1. Intellisense daje tylko ja „ , , i ” jako opcji. Po najechaniu myszką Visual Studio podaje mi następujące wyjaśnienie:EqualsGetHashCodeGetTypeToStringoItem.Property1
MemberMyDataLayer.Section1.MyClass.MyItem.Property1.getcannot be accessed with an instance reference, qualify it with a type name instead
Nie jestem pewien, co to znaczy, trochę googlowałem, ale nie byłem w stanie tego rozgryźć.