Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Tools
- {
- /// <summary>
- /// Lock this object to mark part of code for single thread execution
- /// </summary>
- public static object SyncObject = new object();
- public string TruncateLongString(string inputString, int maxChars, string postfix = ".")
- {
- if (maxChars <= 0)
- throw new ArgumentOutOfRangeException("maxChars");
- if (inputString == null || inputString.Length < maxChars)
- return inputString;
- var truncatedString = inputString.Substring(0, maxChars) + postfix;
- return truncatedString;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement