.Select(permission => (Common.Security.PermissionEnum) System.Enum.Parse(typeof(Common.Security.PermissionEnum), permission.Value));
..is superior to this short code:
.Select(permission => (Common.Security.PermissionEnum) int.Parse(permission.Value));
The first code, even if the enum is updated to long data type, will still work.
How often do we upgrade the enum to long though?
Happy Coding!
No comments:
Post a Comment