nature_net.user_controls.WPFExtensions.TextTrimmed C# (CSharp) Метод

TextTrimmed() публичный статический Метод

This is just a convenience extension-method to simplify the getting of strings from a WPF TextBox. It was a pain in da butt, having to remember to test for nulls, whitespace, etc. Now, all you have to do is check the .Length
public static TextTrimmed ( this textbox ) : string
textbox this The WPF TextBox to get the Text from
Результат string
        public static string TextTrimmed(this System.Windows.Controls.TextBox textbox)
        {
            string sText = textbox.Text;
            if (String.IsNullOrEmpty(sText))
            {
                return "";
            }
            else
            {
                return sText.Trim();
            }
        }