I recently saw a project that was using this style:
(SomeEnum)Enum.ToObject(typeof(SomeEnum), some int)
instead of this style:
(SomeEnum)some int
Why use the former? Is it just a matter of style?
From MSDN:
This conversion method returns a value of type Object. You can then cast it or convert it to an object of type enumType.
https://msdn.microsoft.com/en-us/library/ksbe1e7h(v=vs.110).aspx
It seems to me that MSDN tells me that I should call ToObject(), and then I can cast. But I'm confused because I know I can cast without calling that method. What is the purpose of ToObject()? What does it accomplish that simple casting does not?