public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value != null) { CaseTypeEnum caseType = (CaseTypeEnum)value; return(caseType.GetLocalDescription()); } else { return(value); } }
void StringCaseFormatting() { Console.WriteLine("Input your string"); string str = Console.ReadLine();; Console.WriteLine("Select \n1 for Lower Case\n2 for Upper Case"); CaseTypeEnum caseType = (CaseTypeEnum)(int.Parse(Console.ReadLine())); var result = objStrOperations.StringCaseFormatting(str, caseType); Console.WriteLine("Reversed string is :\n" + result); Console.ReadKey(); }
public override object ConvertFromString(string text, IReaderRow row, MemberMapData memberMapData) { string enumKey = text.Trim().ToLower(); CaseTypeEnum caseType = CaseTypeEnum.Undefined; if (EnumStringMap.ContainsKey(enumKey)) { caseType = EnumStringMap[enumKey]; } return(caseType); }
/// <summary> /// String Case formatting /// </summary> /// <param name="str"></param> /// <param name="caseType"></param> /// <returns></returns> public string StringCaseFormatting(string str, CaseTypeEnum caseType) { switch (caseType) { case CaseTypeEnum.Lower: return(str.ToLower()); case CaseTypeEnum.Upper: return(str.ToUpper()); default: return(str); } }
public void Initilize(CaseTypeEnum caseType) { if (caseType == CaseTypeEnum.Administrative) { this.ShowAdministrative = true; } else if (caseType == CaseTypeEnum.Mixed) { this.ShowMixed = true; } else if (caseType == CaseTypeEnum.Divide) { this.ShowDivide = true; } }
public Desktop(string name, CaseTypeEnum caseType) : base(name) { base.Name = name; CaseType = caseType; computerDefinition = new ForMacOs(); }