Click here to Skip to main content
15,885,546 members
Home / Discussions / C#
   

C#

 
AnswerRe: Using generics without the caller knowing what type to expect Pin
Eddy Vluggen1-Oct-14 9:07
professionalEddy Vluggen1-Oct-14 9:07 
GeneralRe: Using generics without the caller knowing what type to expect Pin
Jörgen Andersson1-Oct-14 21:14
professionalJörgen Andersson1-Oct-14 21:14 
GeneralRe: Using generics without the caller knowing what type to expect Pin
PIEBALDconsult1-Oct-14 9:41
mvePIEBALDconsult1-Oct-14 9:41 
GeneralRe: Using generics without the caller knowing what type to expect Pin
Jörgen Andersson1-Oct-14 21:30
professionalJörgen Andersson1-Oct-14 21:30 
AnswerRe: Using generics without the caller knowing what type to expect Pin
Pete O'Hanlon1-Oct-14 21:23
mvePete O'Hanlon1-Oct-14 21:23 
GeneralRe: Using generics without the caller knowing what type to expect Pin
Jörgen Andersson1-Oct-14 21:35
professionalJörgen Andersson1-Oct-14 21:35 
AnswerRe: Using generics without the caller knowing what type to expect Pin
jschell3-Oct-14 9:20
jschell3-Oct-14 9:20 
AnswerRe: Using generics without the caller knowing what type to expect Pin
aljodav3-Oct-14 18:22
aljodav3-Oct-14 18:22 
Generics cannot be carried to runtime as generics, i.e., the generic type must be specified at compile time. In C#, the only type that can be determined at runtime is
C#
dynamic
Thus:

C#
class A { }
class B:A { }
class C:B { }


C#
public static dynamic ConfigSetting(string s)
{
    switch (s)
    {
        case "A":
            return new A();
        case "C":
            return new C();
        case "double":
            return (double)123;
        case "int":
            return 123;
        default:
            return null as string;
    }
}

QuestionUsing protected set accessor Pin
robwm11-Oct-14 6:23
robwm11-Oct-14 6:23 
AnswerRe: Using protected set accessor Pin
BillWoodruff1-Oct-14 7:00
professionalBillWoodruff1-Oct-14 7:00 
GeneralRe: Using protected set accessor Pin
robwm11-Oct-14 7:17
robwm11-Oct-14 7:17 
AnswerRe: Using protected set accessor Pin
Richard Deeming1-Oct-14 7:01
mveRichard Deeming1-Oct-14 7:01 
GeneralRe: Using protected set accessor Pin
robwm11-Oct-14 7:14
robwm11-Oct-14 7:14 
GeneralRe: Using protected set accessor Pin
Richard Deeming1-Oct-14 7:32
mveRichard Deeming1-Oct-14 7:32 
GeneralRe: Using protected set accessor Pin
robwm11-Oct-14 7:36
robwm11-Oct-14 7:36 
GeneralRe: Using protected set accessor Pin
Andy_L_J1-Oct-14 22:12
Andy_L_J1-Oct-14 22:12 
GeneralRe: Using protected set accessor Pin
robwm12-Oct-14 5:00
robwm12-Oct-14 5:00 
Questionmultiple / change report in one report viewer Pin
just1c3ss1-Oct-14 1:14
just1c3ss1-Oct-14 1:14 
AnswerRe: multiple / change report in one report viewer Pin
ZurdoDev1-Oct-14 1:38
professionalZurdoDev1-Oct-14 1:38 
QuestionPass a value from different project Pin
Member 1102592430-Sep-14 17:42
Member 1102592430-Sep-14 17:42 
AnswerRe: Pass a value from different project Pin
V.30-Sep-14 19:40
professionalV.30-Sep-14 19:40 
AnswerRe: Pass a value from different project Pin
BillWoodruff30-Sep-14 21:24
professionalBillWoodruff30-Sep-14 21:24 
GeneralRe: Pass a value from different project Pin
Member 1102592430-Sep-14 21:26
Member 1102592430-Sep-14 21:26 
GeneralRe: Pass a value from different project Pin
BillWoodruff30-Sep-14 23:25
professionalBillWoodruff30-Sep-14 23:25 
QuestionRe: Pass a value from different project Pin
Kornfeld Eliyahu Peter30-Sep-14 22:01
professionalKornfeld Eliyahu Peter30-Sep-14 22:01 

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.