Currently I implicitly typed eventOperation:
var eventOperation = EventOperations.Cancel;
But I explicitly type eventOperation so that I don't have to assign an arbitrary value before an if statement. Plus, I can't initialize variables within the if statement or have an uninitialized implicit typed variable.
Here's my definition of the static class:
public static class EventOperations
{
...
public static OperationAuthorizationRequirement Cancel =
new OperationAuthorizationRequirement { Name = Constants.CancelOperationName };
}
public class Constants
{
...
public static readonly string CancelOperationName = "Cancel";
...
}
EventOperations.Cancel
obviously is of typeOperationAuthorizationRequirement
. So simply declare your variable as