C# – What are the alternatives to resx file

cresourceswinforms

I am developing a Windows application and I want to store all the text for labels, radio buttons, buttons, check boxes and column headers of grids at one place. I have tried using a class file, an xml file, a database table and a resource file.

I found that a class file is the best way to store all these texts, but I want to know is there any alternative way? If I am using a class file then I will have to recompile the project if any text changes.

Will a resource file work properly for large amounts data? What about a dictionary or storing data in variables?

Best Answer

In short: It sounds to me like a localization of resources (different types like static labels, text, etc..). Generally speaking, changes in resource file content should not require a re-build of the application.

The dis-advantage to store resources in classes, is that each change/modification will require a re-build of the win-form application.

Will a resource file work properly for large amounts data?

I think the limitation is the file-size limitation of the operating system and that is 4 GB on 32 Bit systems, if I remember correctly. For 64 bit it should be even bigger. Anyway, for the purpose to store the static text, it should be more than enough.

Thus, in my opinion, this should not be done anywhere else if the text will be static.

An alternative approach would be creating a class to control access to your resource files. This class might be used to store the keys to access your resource files and a have strongly typed way to retrieve available resources of the project.

Some references on SE answers on localization and resources:

References from MSDN :

Related Topic