Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// <summary>
- /// Represents an immutable repository of strings for localization.
- /// </summary>
- public class TextBank
- {
- /// <summary>
- /// Initializes a new TextBank containing the specified collection of strings.
- /// </summary>
- /// <param name="texts">The collection of strings that should be stored in the repository.</param>
- /// <remarks>The main purpose of a TextBank is localization, they should only ever be loaded from file.
- /// This constructor is intended for tools that generate the localization files.</remarks>
- public TextBank(IEnumerable<string> texts)
- {
- this.texts = (string[])texts.ToArray().Clone();
- }
- string[] texts;
- /// <summary>
- /// The number of strings contained in the repository.
- /// </summary>
- public int Length
- {
- get { return texts.Length; }
- }
- /// <summary>
- /// Gets the string identified by the specified integer key.
- /// </summary>
- /// <param name="key">A non-negative key that identifies the returned string. Must not be greater than or equal to <see cref="Length"/>.</param>
- public string this[int key]
- {
- get { return texts[key]; }
- }
- }
Add Comment
Please, Sign In to add comment