我有一个带有私有变量的完全实现的属性,如下所示:
using System;
namespace ClaimMonitorInfo
{
internal class Claims
{
static Claims()
{
new MainModule();
}
private string claimName = string.Empty;
public string ClaimName
{
get
{
return claimName ;
}
set
{
claimName = value;
}
}
}
}
外部项目将设置它,但属性永远不会在其自己的命名空间中设置。所以Jenkins认为setter从未使用过,并给了我一个警告信息。该类的构造函数是静态的。如何为属性分配默认值?需要提一下的是,项目必须使用MSBuild 12构建,因此C#6.0功能是不可接受的。非常感谢任何帮助。
此致