我有一个关于using多个文件的语句的问题.
我已经为我想在程序中使用的类创建了一个重载.为了在我的一个文件中这样做,我添加了以下using语句.
using ClassName = CustomClassName;
Run Code Online (Sandbox Code Playgroud)
这有效,但仅适用于该特定文件.
有没有办法让这个为我的整个项目工作?
有没有办法获得Dictionary<string,string>C#中所有键的intellisense ?
或者是否可以获得具有字符串参数的方法的intellisense.
我希望有类似的东西ResourceManager.GetString("").如果可能的话,我不想创建一个带有常量字符串的静态类来模拟它.
编辑:
我目前正在使用字典将多个资源文件合并到一个字典中,这样做是因为资源在多个项目中使用并且需要覆盖.
var temp = ResourceFile1.ResourceManager
.GetResourceSet(CultureInfo.CurrentUICulture, true, true)
.Cast<object>()
.Select(
x => new
{
ID = 1,
Value = x.GetType().GetProperty("Value").GetValue(x, null).ToString(),
Key = x.GetType().GetProperty("Key").GetValue(x, null).ToString()
});
temp = temp.Concat(
ResourceFile2.ResourceManager
.GetResourceSet(CultureInfo.CurrentUICulture, true, true)
.Cast<object>()
.Select(
x => new
{
ID = 2,
Value = x.GetType().GetProperty("Value").GetValue(x, null).ToString(),
Key = x.GetType().GetProperty("Key").GetValue(x, null).ToString()
}));
temp = temp.Concat(
ResourceFile3.ResourceManager
.GetResourceSet(CultureInfo.CurrentUICulture, true, true)
.Cast<object>()
.Select(
x => new
{
ID = 3,
Value = x.GetType().GetProperty("Value").GetValue(x, null).ToString(), …Run Code Online (Sandbox Code Playgroud)