[EntLib]关于SR.Strings的使用办法

编写者:郑昀@UltraPower
下载附件。
安装String Resource Generator 1[1].2.5,运行SRGenerator.msi。
然后给自己的工程中添加SR.strings文件,通过VS.NET在现有的.RESXSR.strings文件设置Custom tool属性为:StringResourceToolSRCodeGen
 
使用呢,比如:
我们在SR.strings文件中定义了一行:
ItemNotFoundMessage(key) =  Item not found in cache/r/n/tKey: {0}
那么我们在应用程序中就可以这样:
this.primitivesResultsTextBox.Text += SR.ItemNotFoundMessage(selectItemForm.ItemKey) + "/r/n";
 
其实,这个SR.ItemNotFoundMessage的定义在自动生成的SR.CS文件中:
  public static string ItemNotFoundMessage (string key)
  {
   return Keys.GetString( Keys.ItemNotFoundMessage, key );
  }
 
这种传入方式很利于我们统一应用中的错误描述的生成方式。比如我们可以定义错误描述在SR.strings文件中:
LBS_Request_CannotConnectServer = 无法连接到远端LBS网关服务器:{0}
那么在实际调用时就可以这么:
catch(WebException ex)
{...
    sb.Append(" "+ SR. LBS_Request_CannotConnectServer(_Url) +" /n");
...
}
 
 
其他的SR.Strings定义方式还有:

Name

Value

Comments

Member on SR class

NotAuthorized

You are not authorized, go away

 

String NotAuthorized { get; }

ArgumentInvalid

Argument {0} is not valid

argumentName

String ArgumentInvalid(object argumentName);

ConnectionBad

Connection server: {0}, database {1} invalid

server,db

String ConnectionBad(object server, object db);

OtherStuff

This {0}, is undefined: {1}

 

String OtherStuff(object arg1, object arg2);




编写者:郑昀@UltraPower
下载附件。
安装String Resource Generator 1[1].2.5,运行SRGenerator.msi。
然后给自己的工程中添加SR.strings文件,通过VS.NET在现有的.RESXSR.strings文件设置Custom tool属性为:StringResourceToolSRCodeGen
 
使用呢,比如:
我们在SR.strings文件中定义了一行:
ItemNotFoundMessage(key) =  Item not found in cache/r/n/tKey: {0}
那么我们在应用程序中就可以这样:
this.primitivesResultsTextBox.Text += SR.ItemNotFoundMessage(selectItemForm.ItemKey) + "/r/n";
 
其实,这个SR.ItemNotFoundMessage的定义在自动生成的SR.CS文件中:
  public static string ItemNotFoundMessage (string key)
  {
   return Keys.GetString( Keys.ItemNotFoundMessage, key );
  }
 
这种传入方式很利于我们统一应用中的错误描述的生成方式。比如我们可以定义错误描述在SR.strings文件中:
LBS_Request_CannotConnectServer = 无法连接到远端LBS网关服务器:{0}
那么在实际调用时就可以这么:
catch(WebException ex)
{...
    sb.Append(" "+ SR. LBS_Request_CannotConnectServer(_Url) +" /n");
...
}
 
 
其他的SR.Strings定义方式还有:

Name

Value

Comments

Member on SR class

NotAuthorized

You are not authorized, go away

 

String NotAuthorized { get; }

ArgumentInvalid

Argument {0} is not valid

argumentName

String ArgumentInvalid(object argumentName);

ConnectionBad

Connection server: {0}, database {1} invalid

server,db

String ConnectionBad(object server, object db);

OtherStuff

This {0}, is undefined: {1}

 

String OtherStuff(object arg1, object arg2);




编写者:郑昀@UltraPower
下载附件。
安装String Resource Generator 1[1].2.5,运行SRGenerator.msi。
然后给自己的工程中添加SR.strings文件,通过VS.NET在现有的.RESXSR.strings文件设置Custom tool属性为:StringResourceToolSRCodeGen
 
使用呢,比如:
我们在SR.strings文件中定义了一行:
ItemNotFoundMessage(key) =  Item not found in cache/r/n/tKey: {0}
那么我们在应用程序中就可以这样:
this.primitivesResultsTextBox.Text += SR.ItemNotFoundMessage(selectItemForm.ItemKey) + "/r/n";
 
其实,这个SR.ItemNotFoundMessage的定义在自动生成的SR.CS文件中:
  public static string ItemNotFoundMessage (string key)
  {
   return Keys.GetString( Keys.ItemNotFoundMessage, key );
  }
 
这种传入方式很利于我们统一应用中的错误描述的生成方式。比如我们可以定义错误描述在SR.strings文件中:
LBS_Request_CannotConnectServer = 无法连接到远端LBS网关服务器:{0}
那么在实际调用时就可以这么:
catch(WebException ex)
{...
    sb.Append(" "+ SR. LBS_Request_CannotConnectServer(_Url) +" /n");
...
}
 
 
其他的SR.Strings定义方式还有:

Name

Value

Comments

Member on SR class

NotAuthorized

You are not authorized, go away

 

String NotAuthorized { get; }

ArgumentInvalid

Argument {0} is not valid

argumentName

String ArgumentInvalid(object argumentName);

ConnectionBad

Connection server: {0}, database {1} invalid

server,db

String ConnectionBad(object server, object db);

OtherStuff

This {0}, is undefined: {1}

 

String OtherStuff(object arg1, object arg2);




编写者:郑昀@UltraPower
下载附件。
安装String Resource Generator 1[1].2.5,运行SRGenerator.msi。
然后给自己的工程中添加SR.strings文件,通过VS.NET在现有的.RESXSR.strings文件设置Custom tool属性为:StringResourceToolSRCodeGen
 
使用呢,比如:
我们在SR.strings文件中定义了一行:
ItemNotFoundMessage(key) =  Item not found in cache/r/n/tKey: {0}
那么我们在应用程序中就可以这样:
this.primitivesResultsTextBox.Text += SR.ItemNotFoundMessage(selectItemForm.ItemKey) + "/r/n";
 
其实,这个SR.ItemNotFoundMessage的定义在自动生成的SR.CS文件中:
  public static string ItemNotFoundMessage (string key)
  {
   return Keys.GetString( Keys.ItemNotFoundMessage, key );
  }
 
这种传入方式很利于我们统一应用中的错误描述的生成方式。比如我们可以定义错误描述在SR.strings文件中:
LBS_Request_CannotConnectServer = 无法连接到远端LBS网关服务器:{0}
那么在实际调用时就可以这么:
catch(WebException ex)
{...
    sb.Append(" "+ SR. LBS_Request_CannotConnectServer(_Url) +" /n");
...
}
 
 
其他的SR.Strings定义方式还有:

Name

Value

Comments

Member on SR class

NotAuthorized

You are not authorized, go away

 

String NotAuthorized { get; }

ArgumentInvalid

Argument {0} is not valid

argumentName

String ArgumentInvalid(object argumentName);

ConnectionBad

Connection server: {0}, database {1} invalid

server,db

String ConnectionBad(object server, object db);

OtherStuff

This {0}, is undefined: {1}

 

String OtherStuff(object arg1, object arg2);




编写者:郑昀@UltraPower
下载附件。
安装String Resource Generator 1[1].2.5,运行SRGenerator.msi。
然后给自己的工程中添加SR.strings文件,通过VS.NET在现有的.RESXSR.strings文件设置Custom tool属性为:StringResourceToolSRCodeGen
 
使用呢,比如:
我们在SR.strings文件中定义了一行:
ItemNotFoundMessage(key) =  Item not found in cache/r/n/tKey: {0}
那么我们在应用程序中就可以这样:
this.primitivesResultsTextBox.Text += SR.ItemNotFoundMessage(selectItemForm.ItemKey) + "/r/n";
 
其实,这个SR.ItemNotFoundMessage的定义在自动生成的SR.CS文件中:
  public static string ItemNotFoundMessage (string key)
  {
   return Keys.GetString( Keys.ItemNotFoundMessage, key );
  }
 
这种传入方式很利于我们统一应用中的错误描述的生成方式。比如我们可以定义错误描述在SR.strings文件中:
LBS_Request_CannotConnectServer = 无法连接到远端LBS网关服务器:{0}
那么在实际调用时就可以这么:
catch(WebException ex)
{...
    sb.Append(" "+ SR. LBS_Request_CannotConnectServer(_Url) +" /n");
...
}
 
 
其他的SR.Strings定义方式还有:

Name

Value

Comments

Member on SR class

NotAuthorized

You are not authorized, go away

 

String NotAuthorized { get; }

ArgumentInvalid

Argument {0} is not valid

argumentName

String ArgumentInvalid(object argumentName);

ConnectionBad

Connection server: {0}, database {1} invalid

server,db

String ConnectionBad(object server, object db);

OtherStuff

This {0}, is undefined: {1}

 

String OtherStuff(object arg1, object arg2);




编写者:郑昀@UltraPower
下载附件。
安装String Resource Generator 1[1].2.5,运行SRGenerator.msi。
然后给自己的工程中添加SR.strings文件,通过VS.NET在现有的.RESXSR.strings文件设置Custom tool属性为:StringResourceToolSRCodeGen
 
使用呢,比如:
我们在SR.strings文件中定义了一行:
ItemNotFoundMessage(key) =  Item not found in cache/r/n/tKey: {0}
那么我们在应用程序中就可以这样:
this.primitivesResultsTextBox.Text += SR.ItemNotFoundMessage(selectItemForm.ItemKey) + "/r/n";
 
其实,这个SR.ItemNotFoundMessage的定义在自动生成的SR.CS文件中:
  public static string ItemNotFoundMessage (string key)
  {
   return Keys.GetString( Keys.ItemNotFoundMessage, key );
  }
 
这种传入方式很利于我们统一应用中的错误描述的生成方式。比如我们可以定义错误描述在SR.strings文件中:
LBS_Request_CannotConnectServer = 无法连接到远端LBS网关服务器:{0}
那么在实际调用时就可以这么:
catch(WebException ex)
{...
    sb.Append(" "+ SR. LBS_Request_CannotConnectServer(_Url) +" /n");
...
}
 
 
其他的SR.Strings定义方式还有:

Name

Value

Comments

Member on SR class

NotAuthorized

You are not authorized, go away

 

String NotAuthorized { get; }

ArgumentInvalid

Argument {0} is not valid

argumentName

String ArgumentInvalid(object argumentName);

ConnectionBad

Connection server: {0}, database {1} invalid

server,db

String ConnectionBad(object server, object db);

OtherStuff

This {0}, is undefined: {1}

 

String OtherStuff(object arg1, object arg2);




编写者:郑昀@UltraPower
下载附件。
安装String Resource Generator 1[1].2.5,运行SRGenerator.msi。
然后给自己的工程中添加SR.strings文件,通过VS.NET在现有的.RESXSR.strings文件设置Custom tool属性为:StringResourceToolSRCodeGen
 
使用呢,比如:
我们在SR.strings文件中定义了一行:
ItemNotFoundMessage(key) =  Item not found in cache/r/n/tKey: {0}
那么我们在应用程序中就可以这样:
this.primitivesResultsTextBox.Text += SR.ItemNotFoundMessage(selectItemForm.ItemKey) + "/r/n";
 
其实,这个SR.ItemNotFoundMessage的定义在自动生成的SR.CS文件中:
  public static string ItemNotFoundMessage (string key)
  {
   return Keys.GetString( Keys.ItemNotFoundMessage, key );
  }
 
这种传入方式很利于我们统一应用中的错误描述的生成方式。比如我们可以定义错误描述在SR.strings文件中:
LBS_Request_CannotConnectServer = 无法连接到远端LBS网关服务器:{0}
那么在实际调用时就可以这么:
catch(WebException ex)
{...
    sb.Append(" "+ SR. LBS_Request_CannotConnectServer(_Url) +" /n");
...
}
 
 
其他的SR.Strings定义方式还有:

Name

Value

Comments

Member on SR class

NotAuthorized

You are not authorized, go away

 

String NotAuthorized { get; }

ArgumentInvalid

Argument {0} is not valid

argumentName

String ArgumentInvalid(object argumentName);

ConnectionBad

Connection server: {0}, database {1} invalid

server,db

String ConnectionBad(object server, object db);

OtherStuff

This {0}, is undefined: {1}

 

String OtherStuff(object arg1, object arg2);




编写者:郑昀@UltraPower
下载附件。
安装String Resource Generator 1[1].2.5,运行SRGenerator.msi。
然后给自己的工程中添加SR.strings文件,通过VS.NET在现有的.RESXSR.strings文件设置Custom tool属性为:StringResourceToolSRCodeGen
 
使用呢,比如:
我们在SR.strings文件中定义了一行:
ItemNotFoundMessage(key) =  Item not found in cache/r/n/tKey: {0}
那么我们在应用程序中就可以这样:
this.primitivesResultsTextBox.Text += SR.ItemNotFoundMessage(selectItemForm.ItemKey) + "/r/n";
 
其实,这个SR.ItemNotFoundMessage的定义在自动生成的SR.CS文件中:
  public static string ItemNotFoundMessage (string key)
  {
   return Keys.GetString( Keys.ItemNotFoundMessage, key );
  }
 
这种传入方式很利于我们统一应用中的错误描述的生成方式。比如我们可以定义错误描述在SR.strings文件中:
LBS_Request_CannotConnectServer = 无法连接到远端LBS网关服务器:{0}
那么在实际调用时就可以这么:
catch(WebException ex)
{...
    sb.Append(" "+ SR. LBS_Request_CannotConnectServer(_Url) +" /n");
...
}
 
 
其他的SR.Strings定义方式还有:

Name

Value

Comments

Member on SR class

NotAuthorized

You are not authorized, go away

 

String NotAuthorized { get; }

ArgumentInvalid

Argument {0} is not valid

argumentName

String ArgumentInvalid(object argumentName);

ConnectionBad

Connection server: {0}, database {1} invalid

server,db

String ConnectionBad(object server, object db);

OtherStuff

This {0}, is undefined: {1}

 

String OtherStuff(object arg1, object arg2);




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值