summaryrefslogtreecommitdiff
path: root/proxies/casting_extensions.cs
diff options
context:
space:
mode:
Diffstat (limited to 'proxies/casting_extensions.cs')
-rw-r--r--proxies/casting_extensions.cs15
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