Tuesday 15 June 2010

c# - Design issue with Generics -


I have a class with two public methods:

  class first class { Public IERTTE Gatety (string by user name); Public IERTTE Gatementi (Entry Bye UserID); }   

I want to wrap those methods with normal squared which looks like this: class EntityHandler & lt; T & gt; {The Public Inventory Recovery Entity (T Users) • Return the first class. GateInty (Usergame)}}

will not work at all because the type of userParam is unknown this point . How can I verify that T is int or string and then the appropriate getEntity () method Pass successfully from?

I do not see any requirement for EntityHandler to be normal

  Class EntityHandler {First Class First Class = New First Class (); Public IEntity RetrieveEntity (int user) {return firstClass.GetEntity (userParam); } Public IEntity RetrieveEntity (string usersperm) {return firstClass.GetEntity (userParam); }}    

No comments:

Post a Comment