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

news/2024/7/1 21:50:37
编写者:郑昀@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);





http://www.niftyadmin.cn/n/3649290.html

相关文章

android开源项目和框架

特效: http://www.theultimateandroidlibrary.com/ 常用效果: 1. https://github.com/novoda/ImageLoader 异步加载图片,缓存,生成缩略图, 基本上每个应用都会需要这个lib。 android-query框架 2. https://githu…

prisma 风格设置_Prisma中的身份验证-第1部分:设置

prisma 风格设置Unless if you’re using something like Firebase to handle your authentication, it can be a bit tricky to handle it in a way that is both secure and easy to manage. In this three-part series, we’re going to be going over how to setup your Gr…

RxBus-mvp模式下对Rxjav的封装(一)

一、首先定义一个Presenter接口:DataBusSubscriber 用来接受数据 public interface DataBusSubscriber {void onEvent(Object data); }二、定义一个RxBus的封装类 public class RxBus {public static final String TAG "RxBus";private static volatile…

VS 2005 Team Suite 轻松搞定白盒测试

注:此文的Word版本首次发表于: http://bbs.5etesting.com/viewthread.php?tid18&highlight%B0%D7%BA%D0%B2%E2%CA%D4 VS 2005 Team Suite轻松搞定白盒测试 (此文已于《测试天地》杂志发表,如需转载,请与作者联系…

[推荐]dotNET中进程间同步/通信的经典框架

推荐一篇关于dotNET中常用的进程间同步或通信的框架文章:A C# Framework for Interprocess Synchronization and CommunicationBy Christoph Ruegg How to share resources and implement a rich message/data passing architecture between threads and processes …

Android 开发之RxJava 详解

我从去年开始使用 RxJava ,到现在一年多了。今年加入了 Flipboard 后,看到 Flipboard 的 Android 项目也在使用 RxJava ,并且使用的场景越来越多 。而最近这几个月,我也发现国内越来越多的人开始提及 RxJava 。有人说『RxJava 真是…

RxBus-mvp模式下对Rxjav的封装(二)

一、自定义注解,用于标记观察者模式 Target(ElementType.METHOD) Retention(RetentionPolicy.RUNTIME) Documented public interface RegisterBus {} 二、定义一个RxBus的类 public class RxBus {public static final String TAG "RxBus";private stati…

离子赝势文件_排除离子错误

离子赝势文件Below is a brief overview on how to get started troubleshooting bugs in your Ionic projects. 以下是有关如何开始对Ionic项目中的错误进行故障排除的简要概述。 介绍 (Introduction) There are two main types of bugs that occur when developing in Ionic…