, ,
public void Detele<T>(T toDelete);
( , )
, - . , ..Net , StreamReader, ToString ..
, , , .
( ) -.
Add<T,P>(Action<T,P> addingAction, T source, P param) ( addingAction(source,param); );
//this is naive p.Add(q) it can be arbitralily more complicated
aObject.Add( (p,q) => p.Add(q), myObj, myParam);
, . , , . , . - .
I also introduced an implementation that uses an Action delegate. You can easily convert this code to the Expression class, with which you can create your own delegates at runtime (and cache them after initialization, since this is a rather slow process, i.e., Reflection, etc.). I highly recommend abusing delegates and expressions whenever possible.
Take care Lukas
source
share