如何在C#中访问存储在资源文件中的变量 [英] How to access the variables that are stored in a resource file in C#
本文介绍了如何在C#中访问存储在资源文件中的变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道我可以在C#中使用资源文件来访问变量。如果是,那么如何..?
解决方案
假设你想给一个使用资源文件标记名称然后你可以这样尝试:
< asp:Label ID =lblClassHeadrunat =serverCssClass =LabelText =<%
Resources:Fire,lblClass%> > < / asp:标签>
我想要的是我的项目中有大量静态变量,我想我会将变量存储在资源文件中,并将值分配给它而不是使用变量从C#文件我将从资源文件中获取变量的值。
你可以帮我解决这个问题。
I want to Know that can I use resource file in C# to access the variable.If yes then How..?
解决方案
suppose u want to give a name to label using resource file then u can try like that:
< asp:Label ID="lblClassHead" runat="server" CssClass="Label" Text="<%
Resources:Fire, lblClass %>" > < /asp:Label>
What I want is I have large number of static variables in my Project and I am Thinking that I will Store the Variables in a Resource File along with the Value assigned to it and instead of using the variables From a C# File I will fetch the Value of the Variable from the resource file.
Can you Help me out in this.
这篇关于如何在C#中访问存储在资源文件中的变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文