无法使用实例引用访问成员
members cannot be accessed with an instance reference
为什么我在下面粗体行的代码中遇到了这个错误?
Member IocContainer.ShowWeatherDetailViewModel
(and IocContainer.ShowWeatherViewModel
) cannot be accessed with an instance reference; qualify it with a type name instead.
error code: CS0176
public class IocContainer
{
public static IocContainer Ioc
{
get { return App.Current.Resources["ioc"] as IocContainer; }
}
// Some other static properties.
// static constructor
}
IocContainer.Ioc.ShowWeatherDetailViewModel.Item =
IocContainer.Ioc.ShowWeatherViewModel.SelectedVillage;
我通过 IocContainer.ShowWeatherDetailViewModel
和 IocContainer.ShowWeatherViewModel
实例 属性.
找到了它
感谢@JonSkeet 和@ChrisShain。
为什么我在下面粗体行的代码中遇到了这个错误?
Member
IocContainer.ShowWeatherDetailViewModel
(andIocContainer.ShowWeatherViewModel
) cannot be accessed with an instance reference; qualify it with a type name instead.error code: CS0176
public class IocContainer
{
public static IocContainer Ioc
{
get { return App.Current.Resources["ioc"] as IocContainer; }
}
// Some other static properties.
// static constructor
}
IocContainer.Ioc.ShowWeatherDetailViewModel.Item = IocContainer.Ioc.ShowWeatherViewModel.SelectedVillage;
我通过 IocContainer.ShowWeatherDetailViewModel
和 IocContainer.ShowWeatherViewModel
实例 属性.
感谢@JonSkeet 和@ChrisShain。