andrew4582

TestCultureResources - SR

Oct 17th, 2011
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.74 KB | None | 0 0
  1. using System.Resources;
  2.  
  3. namespace TestCultureResources {
  4.      
  5.     public static class SR {
  6.          
  7.         static ResourceManager s_rm = new ResourceManager("TestCultureResources.UI.Site",typeof(SR).Assembly);
  8.  
  9.         public static string GetString(string name,params object[] args) {
  10.             return GetString(name,null,args);
  11.         }
  12.         public static string GetString(string name,string defaultValue,params object[] args) {
  13.             if(args == null || args.Length == 0) {
  14.                 return s_rm.GetString(name) ?? defaultValue;
  15.             }
  16.             else {
  17.                 string fmt = s_rm.GetString(name) ?? defaultValue;
  18.                 return string.Format(fmt,args);
  19.             }
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment