summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authormo k <mo@mokhan.ca>2012-05-30 22:26:04 -0600
committermo k <mo@mokhan.ca>2012-05-30 22:26:04 -0600
commit18db302a64ad5ace63861a427ea66e0d29af14f3 (patch)
tree39959e18f75fe029a20277b7549cff982136542b /src/core
parentc156ffcd25324e4fd49345b7d76df012f8dc1dd9 (diff)
register subscribers of different events.main
Diffstat (limited to 'src/core')
-rwxr-xr-xsrc/core/extensions/Casting.cs2
-rwxr-xr-xsrc/core/extensions/Dynamic.cs8
2 files changed, 8 insertions, 2 deletions
diff --git a/src/core/extensions/Casting.cs b/src/core/extensions/Casting.cs
index 24c12a6..03f6047 100755
--- a/src/core/extensions/Casting.cs
+++ b/src/core/extensions/Casting.cs
@@ -2,7 +2,7 @@ namespace core.extensions
{
public static class Casting
{
- public static T DowncastTo<T>(this object item) where T : class
+ public static T downcast_to<T>(this object item) where T : class
{
return item as T;
}
diff --git a/src/core/extensions/Dynamic.cs b/src/core/extensions/Dynamic.cs
index b08f7b1..df34945 100755
--- a/src/core/extensions/Dynamic.cs
+++ b/src/core/extensions/Dynamic.cs
@@ -6,7 +6,13 @@ namespace core.extensions
{
public static void call_as<DynamicType>(this object target, Action<DynamicType> command) where DynamicType : class
{
- command(target.DowncastTo<DynamicType>());
+ target.downcast_to<DynamicType>().run(command);
+ }
+
+ public static void run<T>(this T target, Action<T> command)
+ {
+ if (null == target) return;
+ command(target);
}
}
} \ No newline at end of file