[Solved] Need Converting Help C# to F#
Something like this should do the trick: let getEnumDescription value = let fi = value.GetType().GetField(value.ToString()) let attributes = fi.GetCustomAttributes(typedefof<DescriptionAttribute>, false) |> Array.map (fun x -> x :?> DescriptionAttribute) if attributes.Length > 0 then attributes.[0].Description else value.ToString() Then you can call it like so: let red = Color.Red |> getEnumDescription let blue = Color.Blue |> getEnumDescription … Read more