以下是我的代碼:一個字段初始不能引用非靜態字段,方法或屬性
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