This project has moved. For the latest updates, please go here.
Connected properties only allow attaching data to carrier objects, but you may attach a delegate as data. It can then be used as a connected method.

This is similar to setting delegates on an ExpandoObject.

private const string LogMethod = Guid.NewGuid().ToString("N");

public void Log(object obj)
  var logMethodProperty = PropertyConnector.Default.Get(obj, LogMethod);
  Action logMethod;
  if (logMethodProperty.TryGet(out logMethod))
    // This instance has a connected Log method.
    // This instance does not have a connected Log method.

Note that connected methods are different than extension methods. Extension methods extend a type, and can be called for any instance of that type. Connected methods extend an instance, so they can be overridden on a per-instance basis.

Last edited Aug 30, 2013 at 4:49 AM by StephenCleary, version 5


No comments yet.