throw new invalidoperationexception c#