public static string ToString(this bool value, BooleanText booleanText) { MatchCollection matches = Regex.Matches(booleanText.ToString(), "[A-Z][a-z]+"); return(value.ToString(matches[0].Value, matches[1].Value)); // return Convert.ToString(value).ToString().ToLower(); }
/// <summary> /// Assesses a boolean value and returns a textual value /// </summary> /// <param name="text">The textual value to be returned</param> /// <returns>A textual representation of the boolean value</returns> /// <remarks></remarks> public static string GetAsWord(this bool value, BooleanText text) { switch (text) { case BooleanText.AcceptedDeclined: return value.GetAsWord("Accepted", "Declined"); case BooleanText.ActiveInactive: return (value) ? "Active" : "Inactive"; case BooleanText.CheckedUnchecked: return (value) ? "Checked" : "Unchecked"; case BooleanText.CorrectIncorrent: return (value) ? "Correct" : "Incorrent"; case BooleanText.EnabledDisabled: return (value) ? "Enabled" : "Disabled"; case BooleanText.OnOff: return (value) ? "On" : "Off"; case BooleanText.YesNo: return (value) ? "Yes" : "No"; default : return (value) ? "True" : "False"; } }
/// <summary> /// Assesses a boolean value and returns a textual value /// </summary> /// <param name="text">The textual value to be returned</param> /// <returns>A textual representation of the boolean value</returns> /// <remarks></remarks> public static string ToString(this bool value, BooleanText text) { MatchCollection matches = _regEx.Matches(text.ToString()); return(value.ToString(matches[0].Value, matches[1].Value)); }