Advertisement
Guest User

Untitled

a guest
May 21st, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.39 KB | None | 0 0
  1. public static class SharedStrings
  2. {
  3.     private static Dictionary<int, string> myStrings;
  4.  
  5.     static SharedStrings()
  6.     {
  7.         myStrings = new Dictionary<int, string>();
  8.         myStrings.Add(42, "hello");
  9.     }
  10.  
  11.     public static string GetStringFromIndex(int index)
  12.     {
  13.         lock (typeof(SharedStrings))
  14.         {
  15.             return myStrings[index];
  16.         }
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement