Trigger4Win/Trigger/Extensions/TextBox.cs
2015-04-10 00:09:58 +00:00

31 lines
No EOL
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);
}
}
}