Click here to Skip to main content
15,910,083 members
Home / Discussions / C#
   

C#

 
QuestionAuto Login on Webpage using C# Pin
mjmcinto30-Nov-05 2:54
mjmcinto30-Nov-05 2:54 
QuestionRe: Auto Login on Webpage using C# Pin
mjmcinto30-Nov-05 8:58
mjmcinto30-Nov-05 8:58 
QuestionAssigning commandbar images Pin
Daniel Ion30-Nov-05 1:18
Daniel Ion30-Nov-05 1:18 
QuestionC# Add-in file synchronisation problem Pin
tartancli30-Nov-05 0:52
tartancli30-Nov-05 0:52 
AnswerRe: Need you help Pin
Hiral Patel30-Nov-05 23:05
Hiral Patel30-Nov-05 23:05 
GeneralRe: Need you help Pin
tartancli5-Dec-05 9:48
tartancli5-Dec-05 9:48 
GeneralRe: Need you help Pin
Hiral Patel5-Dec-05 22:06
Hiral Patel5-Dec-05 22:06 
QuestionSystem.type Pin
theEder30-Nov-05 0:38
theEder30-Nov-05 0:38 
Hi Everyone,
I got this code:

if(file.Name.StartsWith(Cont_"))
{
engine = new FileHelperEngine(typeof(Contact));
Contact[] details = (Contact[])engine.ReadFile(file.FullName);
foreach(Contact info in details)
{
txtoutput.Text += info.toString();
}
}
else
{
engine = new FileHelperEngine(typeof(OSFUNOUT));
OSFUNOUT[] details = (OSFUNOUT[])engine.ReadFile(file.FullName);
foreach(OSFUNOUT info in details)
{
txtOutput2.Text += info.toString();
}
}

and wanted to change it to this sort of code:

System.Type type;
if(file.Name.StartsWith("Cont_"))
{
type = typeof(Contact);
}
else
{
type = typeof(OSFUNOUT);
}

engine = new FileHelperEngine(type);

type[] details = (type[])engine.ReadFile(file.FullName); *****
foreach(type info in details) ****
{
txtoutput.Text += info.toString();
}

However the lines with the **** are giving me problems, how do I create an instance of that type?

I could change it to
object[] details = engine.ReadFile(file.FullName);
foreach(object info in details) ****
{
txtoutput.Text += info.toString();
}
however i still need then to cast info to the class I'm working with...how would i do this (type)info doesn't work...

thanks. Smile | :)

AnswerRe: System.type Pin
Andy Brummer1-Dec-05 8:26
sitebuilderAndy Brummer1-Dec-05 8:26 
GeneralRe: System.type Pin
theEder1-Dec-05 19:11
theEder1-Dec-05 19:11 
QuestionApi hooking Pin
razi3lll30-Nov-05 0:17
razi3lll30-Nov-05 0:17 
AnswerRe: Api hooking Pin
Landarzar30-Nov-05 7:55
Landarzar30-Nov-05 7:55 
GeneralRe: Api hooking Pin
razi3lll30-Nov-05 20:31
razi3lll30-Nov-05 20:31 
QuestionAssembly Question Pin
snouto29-Nov-05 23:59
snouto29-Nov-05 23:59 
AnswerRe: Assembly Question Pin
Rob Philpott30-Nov-05 1:02
Rob Philpott30-Nov-05 1:02 
QuestionAccess Second User Control Forms Objects Properties Pin
freshonlineMax29-Nov-05 23:16
freshonlineMax29-Nov-05 23:16 
AnswerRe: Access Second User Control Forms Objects Properties Pin
S. Senthil Kumar30-Nov-05 0:21
S. Senthil Kumar30-Nov-05 0:21 
GeneralRe: Access Second User Control Forms Objects Properties Pin
freshonlineMax30-Nov-05 4:00
freshonlineMax30-Nov-05 4:00 
QuestionCompute Method of Dataset Pin
meeram39529-Nov-05 22:50
meeram39529-Nov-05 22:50 
AnswerRe: Compute Method of Dataset Pin
freshonlineMax30-Nov-05 3:30
freshonlineMax30-Nov-05 3:30 
GeneralRe: Compute Method of Dataset Pin
meeram39530-Nov-05 16:10
meeram39530-Nov-05 16:10 
GeneralRe: Compute Method of Dataset Pin
freshonlineMax30-Nov-05 18:56
freshonlineMax30-Nov-05 18:56 
Questionhow to capture frames from video Pin
nav123429-Nov-05 19:32
nav123429-Nov-05 19:32 
QuestionTypecast String to unsafe char* and vice versa Pin
Sylvain Boissé29-Nov-05 18:30
Sylvain Boissé29-Nov-05 18:30 
AnswerRe: Typecast String to unsafe char* and vice versa Pin
Sylvain Boissé30-Nov-05 3:58
Sylvain Boissé30-Nov-05 3:58 

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.