Static Binding

Posts   
 
    
Ian avatar
Ian
User
Posts: 511
Joined: 01-Apr-2005
# Posted on: 31-Oct-2005 03:21:32   

Hi,

Take this code...


SortClauseFactory.Create((SubscriptionsFieldIndex)Enum.Parse(typeof(SubscriptionsFieldIndex), sort), SortOperator.Descending)

So the correct version of create won't be known until runtime and yet the different version are overloads.

Is this a special feature of .net? Are there any other ways of binding at runtime except virtual functions?

Cheers, I.

Ian avatar
Ian
User
Posts: 511
Joined: 01-Apr-2005
# Posted on: 31-Oct-2005 03:23:39   

Well you ask a question and the answer immediately comes! I'm getting mixed up, its not binding a different method at runtime. You'd get a different method if it was a diffferent type of enum not value.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 31-Oct-2005 08:25:09   

Ian wrote:

Well you ask a question and the answer immediately comes! I'm getting mixed up, its not binding a different method at runtime. You'd get a different method if it was a diffferent type of enum not value.

Yes that's typical overloading of a method.

Frans Bouma | Lead developer LLBLGen Pro