JabbR.Services.ChatService.ValidateNote C# (CSharp) Method

ValidateNote() static private method

static private ValidateNote ( string note, string noteTypeName = "note", int maxLength = null ) : void
note string
noteTypeName string
maxLength int
return void
        internal static void ValidateNote(string note, string noteTypeName = "note", int? maxLength = null)
        {
            var lengthToValidateFor = (maxLength ?? NoteMaximumLength);
            if (!String.IsNullOrWhiteSpace(note) &&
                note.Length > lengthToValidateFor)
            {
                throw new InvalidOperationException(
                    String.Format("Sorry, but your {1} is too long. Can please keep it under {0} characters.",
                        lengthToValidateFor, noteTypeName));
            }
        }