AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
ActionExtensions.cs
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // Licensed under the MIT License. See LICENSE in the project root for license information.
3 
4 using System;
5 
6 namespace HoloToolkit.Unity
7 {
12  public static class ActionExtensions
13  {
14  public static void RaiseEvent(this Action action)
15  {
16  if (action != null)
17  {
18  action();
19  }
20  }
21 
22  public static void RaiseEvent<T>(this Action<T> action, T arg)
23  {
24  if (action != null)
25  {
26  action(arg);
27  }
28  }
29 
30  public static void RaiseEvent<T1, T2>(this Action<T1, T2> action, T1 arg1, T2 arg2)
31  {
32  if (action != null)
33  {
34  action(arg1, arg2);
35  }
36  }
37 
38  public static void RaiseEvent<T1, T2, T3>(this Action<T1, T2, T3> action, T1 arg1, T2 arg2, T3 arg3)
39  {
40  if (action != null)
41  {
42  action(arg1, arg2, arg3);
43  }
44  }
45 
46  public static void RaiseEvent<T1, T2, T3, T4>(this Action<T1, T2, T3, T4> action, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
47  {
48  if (action != null)
49  {
50  action(arg1, arg2, arg3, arg4);
51  }
52  }
53  }
54 }
static void RaiseEvent(this Action action)
Extensions for the action class. These methods encapsulate the null check before raising an event for...