ExtensionMethod.NET Home of 816 C#, Visual Basic, F# and Javascript extension methods

GetBoolString

If you need to show "Yes" or "No" depending on some bool property

Source

public static string GetBoolString(this bool value)
{
    return value ? "Yes" : "No";
}

Example

string active = viewModel.IsActive.GetBoolStringFor();

Author: Djordje Djukic

Submitted on: 10 jul 2016

Language: C#

Type: string

Views: 2065