예제 #1
0
 public static T ValidateEventData <T>(BaseEventData data) where T : class
 {
     if (data as T == null)
     {
         throw new ArgumentException($"Invalid type: {data.GetType()} passed to event expecting {typeof(T)}");
     }
     return(data as T);
 }
예제 #2
0
 public static T ValidateEventData <T>(BaseEventData data) where T : class
 {
     if ((data as T) == null)
     {
         throw new ArgumentException(String.Format("Invalid type: {0} passed to event expecting {1}",
                                                   data.GetType(), typeof(T)));
     }
     return(data as T);
 }