diff options
| author | mo k <mo@mokhan.ca> | 2012-05-03 12:44:39 -0600 |
|---|---|---|
| committer | mo k <mo@mokhan.ca> | 2012-05-03 12:44:39 -0600 |
| commit | 2ea2730e65af8e7849c6f36443f87e8731ffd5be (patch) | |
| tree | 3b9455098690e0038d0f04754b4c34a91cd34162 /proxies/casting_extensions.cs | |
initial checkin.main
Diffstat (limited to 'proxies/casting_extensions.cs')
| -rw-r--r-- | proxies/casting_extensions.cs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/proxies/casting_extensions.cs b/proxies/casting_extensions.cs new file mode 100644 index 0000000..e8cfcd6 --- /dev/null +++ b/proxies/casting_extensions.cs @@ -0,0 +1,15 @@ +namespace proxies
+{
+ public static class casting_extensions
+ {
+ public static bool is_a<T>(this object item) where T : class
+ {
+ return item as T != null;
+ }
+
+ public static T downcast_to<T>(this object item)
+ {
+ return (T) item;
+ }
+ }
+}
\ No newline at end of file |
