2007-05-25 Jonathan Chambers <joncham@gmail.com>
[mcs.git] / tests / gtest-200.cs
blobb7e219b53afc2f044c02df2a247ff8d5651fd505
1 class Test
4 public static T QueryInterface<T>(object val)
5 where T : class
7 if (val == null)
8 return null;
10 // First, see if the given object can be directly cast
11 // to the requested type. This will be a common case,
12 // especially when checking for standard behavior interface
13 // implementations (like IXrcDataElement).
14 T tval = val as T;
15 if (tval != null)
16 return tval;
18 // ... rest of method unimportant and omitted ...
19 return null;
23 class Driver
25 public static void Main () {}