get max enum value csharp

Code Example - get max enum value csharp

                
                        var lastFoo = Enum.GetValues(typeof(Foo)).Cast<Foo>().Max();