title: How to extend/decorate third-party classes in VB.NET?
body: <p>In Ruby all classes are forever open.  New behavior can be added to any class at just about any time.  Is there a way to do this in VB.NET?</p>
  
  <p>For example, what if I want all DataRows in an existing app (a large one) to take on a new behavior.  I realize I could create a custom row class that inherits from DataRow, but inheritance is not what I'm after.  That would involved a lot of rework to make sure that at all places rows are instantiated, we are instantiating from our custom row class.</p>
  
  <p>I had two rough ideas about how this might be done:</p>
  
  <ol>
  <li><p>It occurred to me that aspects (AOP) could work here.  <a href="https://stackoverflow.com/questions/11395606/is-there-a-simple-means-of-adding-an-aspect-to-an-existing-vb-net-method">Is there a way to layer behavior on top of existing methods?</a></p></li>
  <li><p>Would it be possible to apply <a href="https://stackoverflow.com/questions/11368353/can-an-interface-be-retroactively-implemented-in-vb-net">a given Interface to existing classes</a>.  </p></li>
  </ol>
  
  <p>The primary goal here is to not have to do any large retrofit of existing code.  The system should practically remain oblivious to these layered-on behaviors/aspects.  It should involve a minimal change to the codebase.</p>
  
  <p>Currently, we implement layered aspects using decorator classes.  The problem is, the system knows the difference between a native row and a row decorator object.  I want to be able to pass around something that the system thinks is a native row.  Again, the system needn't be mindful of the decorations applied to the row.  It should think it has a row, not some special decorator.</p>
  
  <p>Specifically, I want to decorate the default set Item(colName) property of a row so that I can modify the incoming value.</p>