31 lines
1 KiB
C#
31 lines
1 KiB
C#
|
using System;
|
|||
|
using System.Windows.Forms;
|
|||
|
|
|||
|
namespace ExtensionMethods
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// <para>Add extensions to <c><see cref="TextBox"/></c></para>
|
|||
|
/// </summary>
|
|||
|
public static class TextBoxExtensions
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// <para>Indicates whether the content of the specified <see cref="TextBox"/> is null or an <see cref="String.Empty"/> string</para>
|
|||
|
/// </summary>
|
|||
|
/// <param name="txt"></param>
|
|||
|
/// <returns><see cref="bool"/>. True: TextBox is empty. False: TextBox is not empty</returns>
|
|||
|
public static bool IsEmpty(this TextBox txt)
|
|||
|
{
|
|||
|
return String.IsNullOrEmpty(txt.Text);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <para>Indicates whether the content of the specified <see cref="TextBox"/> is not null and not an <see cref="String.Empty"/> string</para>
|
|||
|
/// </summary>
|
|||
|
/// <param name="txt"></param>
|
|||
|
/// <returns><see cref="bool"/>. True: TextBox is not empty. False: TextBox is empty</returns>
|
|||
|
public static bool IsNotEmpty(this TextBox txt)
|
|||
|
{
|
|||
|
return !String.IsNullOrEmpty(txt.Text);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|