Create 2 instance with the same name

I

Islam Elkhayat

I have to 2 Data classes have the same methods with defferent implemention
which work with 2 tables in the database..
I want to chnge the instance referance depend on if condition or switch
case..
like this...

myclass.AddRow()

where my class can be instance of Categories or Employees so i don't have to
write the same code twice..
I tried Activator.CreateInstance(); which return an object but i couldn't
access methods..
Is there a way to make it work??
thanx
 
G

Guest

have them either both inherit from the same base class or both implement a
common interface. whichever makes more sense in your situation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top