Reputation: 2997
I have been generating a StronglyTypedClass file using resgen.exe in my Windows Form application using C# and .NET 4.5
According to syntax I can make the StringResources class as public but the Constructor still remains internal.
resgen inputFilename [outputFilename] /str:language[,namespace,[classname[,filename]]] [/publicClass]
When I put this argument [/publicClass], it just makes the class as public but the constructor is still internal.
internal StringResources() {}
Please suggest, how to achieve this.
Upvotes: 3
Views: 454
Reputation: 12319
Very likely your teammate wanted to have that constructor public because he wants to use the resources in xaml.
Just create a class in the same assembly, which inherits the resources file and exposes a public constructor, then use this class instead.
public class ResourcesProxy : Properties.Resources
{
/// <summary>
/// resolves the problem of internal constructor in resources.designer.cs
/// in conjunction with xaml usage
/// </summary>
public ResourcesProxy() : base()
{
}
}
Upvotes: 2