Click here to Skip to main content
15,917,062 members
Home / Discussions / C#
   

C#

 
GeneralRe: Database Routines Pin
Wayne Phipps9-Feb-07 5:02
Wayne Phipps9-Feb-07 5:02 
QuestionExporting DataGrid to Excel Pin
pssuresh8-Feb-07 2:52
pssuresh8-Feb-07 2:52 
AnswerRe: Exporting DataGrid to Excel Pin
Sandeep Akhare8-Feb-07 3:11
Sandeep Akhare8-Feb-07 3:11 
GeneralRe: Exporting DataGrid to Excel Pin
pssuresh8-Feb-07 3:24
pssuresh8-Feb-07 3:24 
GeneralRe: Exporting DataGrid to Excel Pin
Sandeep Akhare8-Feb-07 3:44
Sandeep Akhare8-Feb-07 3:44 
GeneralRe: Exporting DataGrid to Excel [modified] Pin
pssuresh8-Feb-07 3:56
pssuresh8-Feb-07 3:56 
QuestionBtrieve Database Pin
coolestCoder8-Feb-07 2:35
coolestCoder8-Feb-07 2:35 
QuestionCast to a Generic Type at runtime Pin
Florian Storck8-Feb-07 2:30
Florian Storck8-Feb-07 2:30 
Hi,

I have the following problem:

I have a generic, which derives from a normal base class like this:

public class MyClass <T> : BaseClass
{
T m_Value;

public SetValue(T val)
{
// ...
}
public T GetValue(){ ... } ;
}


These classes are stored in a generic dictionary, which is instantiated like this:


dictionary<string, BaseClass> dic = new dictionary<string, BaseClass>();


At one point, I want to acess the SetValue Function, but I have to cast to the exact type, and typeof() / GetType doesn't works here.
What I try to do looks similar like this, but I haven't a solution yet;

MyClass< dic["Key"].GetType() > tC, tC2;
tC.SetValue((dic["Key"].GetType())dic["Key"].GetValue());

This isn't correct (i left out the instantiation) , I know, but I need to cast at runtime to the exact
generic type, stored at the position in the dictionary, for accessing the
generic, type specific Get/Set function.

Any comments ?

Thanks,
Florian



QuestionDelegate Help Pin
JeremyLM8-Feb-07 2:29
JeremyLM8-Feb-07 2:29 
AnswerRe: Delegate Help Pin
aSarafian8-Feb-07 3:23
aSarafian8-Feb-07 3:23 
GeneralRe: Delegate Help Pin
JeremyLM8-Feb-07 4:04
JeremyLM8-Feb-07 4:04 
QuestionUpdating and removing nodes from a treeview Pin
sharpiesharpie8-Feb-07 2:12
sharpiesharpie8-Feb-07 2:12 
AnswerRe: Updating and removing nodes from a treeview Pin
Ravi Bhavnani8-Feb-07 6:16
professionalRavi Bhavnani8-Feb-07 6:16 
QuestionAdding compiled help to a C# project Pin
Antony M Kancidrowski8-Feb-07 1:58
Antony M Kancidrowski8-Feb-07 1:58 
AnswerRe: Adding compiled help to a C# project Pin
Sandeep Akhare8-Feb-07 3:14
Sandeep Akhare8-Feb-07 3:14 
GeneralRe: Adding compiled help to a C# project Pin
Antony M Kancidrowski8-Feb-07 4:24
Antony M Kancidrowski8-Feb-07 4:24 
Questionstring process Pin
Mohammad Daba'an8-Feb-07 1:56
Mohammad Daba'an8-Feb-07 1:56 
AnswerRe: string process Pin
Antony M Kancidrowski8-Feb-07 2:02
Antony M Kancidrowski8-Feb-07 2:02 
GeneralRe: string process Pin
Mohammad Daba'an8-Feb-07 2:06
Mohammad Daba'an8-Feb-07 2:06 
GeneralRe: string process Pin
Antony M Kancidrowski8-Feb-07 2:16
Antony M Kancidrowski8-Feb-07 2:16 
GeneralRe: string process Pin
Mohammad Daba'an8-Feb-07 2:23
Mohammad Daba'an8-Feb-07 2:23 
GeneralRe: string process Pin
aSarafian8-Feb-07 2:29
aSarafian8-Feb-07 2:29 
GeneralRe: string process Pin
Mohammad Daba'an9-Feb-07 20:36
Mohammad Daba'an9-Feb-07 20:36 
GeneralRe: string process Pin
Antony M Kancidrowski8-Feb-07 2:31
Antony M Kancidrowski8-Feb-07 2:31 
GeneralRe: string process Pin
Mohammad Daba'an9-Feb-07 20:36
Mohammad Daba'an9-Feb-07 20: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.