Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C# 2.0 Return DataReader object
Message
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01537785
Message ID:
01537809
Vues:
25
>>Hi,
>>
>>I have a method that needs to return either OleDbDataReader or SqlDataReader (depends on the back-end database). Within the method I have IF/ELSE where the code is processed accordingly. But in the method signature I can only specify one type of reader. E.g.
>>
>>public OleDbDataReader MethodName()
>>or
>>public SqlDataReader MethodName()
>>
>>
>>Does it mean that I have to split the method into two methods depending on the type of reader I need to return and deal with it at the calling level?
>>
>>TIA.
>
>Sounds like the perfect spot for a generic.

Easy for you to say <g>. I don't know how to use generic and am trying not to change the production application in a major way (or it will break big time). But I will read on this. Thanks.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform