How to set properties if class has a static constructor?

112 Views Asked by At

I have a fully implemented property with private variable as shown below:

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;
            }
        }
    }
}

External projects will be setting it but the property never gets set inside its own namespace. So Jenkins thought setter has never been used and gave me a warning message. The constructor of the class is static. How can I assign default values for the property? Need to mention that, project has to be built with MSBuild 12, so C# 6.0 features won't be acceptable. Any help is greatly appreciated.

Sincerely

0

There are 0 best solutions below