Click here to Skip to main content
15,897,891 members
Home / Discussions / C#
   

C#

 
AnswerRe: Where does the webbrowser keep images? Pin
aj.esler10-Dec-07 0:30
aj.esler10-Dec-07 0:30 
QuestionDatabase learning basics Pin
kingletas9-Dec-07 12:15
kingletas9-Dec-07 12:15 
GeneralRe: Database learning basics Pin
Christian Graus9-Dec-07 13:14
protectorChristian Graus9-Dec-07 13:14 
GeneralLocating objects that throw the NullReferenceException in Deployed Applications [modified] Pin
Brett Blatchley9-Dec-07 11:36
Brett Blatchley9-Dec-07 11:36 
GeneralRe: Locating objects that throw the NullReferenceException in Deployed Applications Pin
Christian Graus9-Dec-07 13:25
protectorChristian Graus9-Dec-07 13:25 
GeneralRe: Locating objects that throw the NullReferenceException in Deployed Applications Pin
Brett Blatchley9-Dec-07 17:58
Brett Blatchley9-Dec-07 17:58 
GeneralRe: Locating objects that throw the NullReferenceException in Deployed Applications Pin
mav.northwind10-Dec-07 2:22
mav.northwind10-Dec-07 2:22 
QuestionReusing a method that takes class as argument Pin
karthikde19809-Dec-07 11:27
karthikde19809-Dec-07 11:27 
Dear friends,

Please help me with the following:

In a C# program, how can I reuse a method that takes classes (or list of classes, List<classname> ) as arguments? The method is defined inside a class.

Presently, the method in my program works only if "the object of the function call" and "the object defined in the parameter list of the function" are the same. Thus practically I have to repeat the method code as many times as the function is called, each with a different class as argument.

The following shows the gravity of my situation: Supposing there are 10 such methods in my c# program and each method (which by itself is quite long and detailed) has to be performed on 10 different classes as arguments.

What I want is, the method (written as a single copy, meaning, if-else option is ruled out) should accept any suitable class passed to it, any number of times, and produce the result. I am looking for a suitable way, using for example, inheritance. Use of gettype to resolve the classname doesnot work as it produces complie errors.

Suppose if the method takes Int or Double argument types, this problem does not arise; thus, is this a fundamental problem in OOP languages? Is there a classical method (I mean, not workaround) to overcome this problem?

Anyway I would be happy to learn an efficient workaround too!

Thanks for ur replies in advance!

Greetings,
Karthik
GeneralRe: Reusing a method that takes class as argument Pin
Christian Graus9-Dec-07 13:16
protectorChristian Graus9-Dec-07 13:16 
GeneralRe: Reusing a method that takes class as argument Pin
Anthony Mushrow9-Dec-07 15:46
professionalAnthony Mushrow9-Dec-07 15:46 
GeneralRe: Reusing a method that takes class as argument Pin
Christian Graus9-Dec-07 16:23
protectorChristian Graus9-Dec-07 16:23 
Generalsize of a structure Pin
daavena9-Dec-07 8:22
daavena9-Dec-07 8:22 
GeneralRe: size of a structure Pin
Paul Conrad9-Dec-07 12:41
professionalPaul Conrad9-Dec-07 12:41 
GeneralRe: size of a structure Pin
Colin Angus Mackay9-Dec-07 14:36
Colin Angus Mackay9-Dec-07 14:36 
QuestionWPF hardware acceleration Pin
Bartosz Bien9-Dec-07 7:26
Bartosz Bien9-Dec-07 7:26 
GeneralRe: WPF hardware acceleration Pin
Christian Graus9-Dec-07 9:32
protectorChristian Graus9-Dec-07 9:32 
GeneralRe: WPF hardware acceleration Pin
CKnig9-Dec-07 18:37
CKnig9-Dec-07 18:37 
GeneralRe: WPF hardware acceleration Pin
Paul Conrad9-Dec-07 12:43
professionalPaul Conrad9-Dec-07 12:43 
QuestionPortable .Net?! Pin
Rojan Gh.9-Dec-07 3:26
professionalRojan Gh.9-Dec-07 3:26 
AnswerRe: Portable .Net?! Pin
Ri Qen-Sin9-Dec-07 3:59
Ri Qen-Sin9-Dec-07 3:59 
QuestionRe: Portable .Net?! Pin
Rojan Gh.9-Dec-07 4:21
professionalRojan Gh.9-Dec-07 4:21 
GeneralRe: Portable .Net?! Pin
mav.northwind9-Dec-07 4:30
mav.northwind9-Dec-07 4:30 
GeneralRe: Portable .Net?! Pin
Ri Qen-Sin9-Dec-07 4:57
Ri Qen-Sin9-Dec-07 4:57 
GeneralRe: Portable .Net?! Pin
mav.northwind9-Dec-07 5:36
mav.northwind9-Dec-07 5:36 
AnswerRe: Portable .Net?! Pin
Giorgi Dalakishvili9-Dec-07 4:36
mentorGiorgi Dalakishvili9-Dec-07 4:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.