以下是我的代码:一个字段初始不能引用非静态字段,方法或属性
private BitsManager manager;
private const string DisplayName = "Test Job";
public SyncHelper()
{
manager = new BitsManager();
}
BitsJob uploadBitsJob = manager.CreateJob(DisplayName, JobType.Upload);
我收到以下错误:
A field initializer cannot reference the non-static field, method, or property 'BITSIntegrationModule.SyncService.SyncHelper.manager'
那你有什么部分消息有问题? – 2013-03-04 14:59:02
如果OP包含'SyncHelper'的类声明,问题会更加清楚。 – 2013-03-04 15:14:57
不要忘记*在你的问题中提出问题*。这里没有问题,只是对某些行为的描述。 – 2013-03-04 15:54:39