How to pass a method as a parameter


Author
Message
Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
I want to set up a General Purpose type method which will have two parameters, a Business Object, and a Method Name of the business object. The method then needs to just run the method.

e.g.

private void RunABoMethod(BusinessObject myBo, Methodname MyMethodname))
{
      myBO.MyMethodname;
}
so some examples of how this might be called:
RunABoMethod(CustomerBO,"GetAllrecords");
or
RunABomethod(StockBO,"GetTop20");


Any suggestions / coding examples on how this might be accomplished (c#) would be appreciated. A few searches indicate that Func (Dot Net 3.5) or delgates could be used but I have no experience of using these constructs
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search