Click here to Skip to main content
15,914,419 members
Home / Discussions / C#
   

C#

 
AnswerRe: create object from returned Type Pin
Guffa15-Jul-08 13:57
Guffa15-Jul-08 13:57 
GeneralRe: create object from returned Type Pin
DaveyM6915-Jul-08 14:06
professionalDaveyM6915-Jul-08 14:06 
GeneralRe: create object from returned Type Pin
Guffa15-Jul-08 14:18
Guffa15-Jul-08 14:18 
GeneralRe: create object from returned Type Pin
DaveyM6915-Jul-08 21:47
professionalDaveyM6915-Jul-08 21:47 
GeneralRe: create object from returned Type Pin
DaveyM6915-Jul-08 21:59
professionalDaveyM6915-Jul-08 21:59 
GeneralRe: create object from returned Type Pin
Guffa16-Jul-08 1:33
Guffa16-Jul-08 1:33 
AnswerRe: create object from returned Type [modified] Pin
DaveyM6915-Jul-08 22:13
professionalDaveyM6915-Jul-08 22:13 
GeneralRe: create object from returned Type [modified] Pin
Guffa16-Jul-08 1:37
Guffa16-Jul-08 1:37 
That's misuse of the var keyword. It should look like this:

object x = Activator.CreateInstance(returnedType);


It's still pretty useless. You can't really do anything with the data without checking the type and unboxing it. What is it that you are trying to accomplish?

[edit]

Actually, it's totally useless. You have created an instance of a value type without a value, and as it's boxed, you can't set the value of the instance.

Despite everything, the person most likely to be fooling you next is yourself.

modified on Wednesday, July 16, 2008 8:52 AM

GeneralRe: create object from returned Type Pin
DaveyM6916-Jul-08 8:29
professionalDaveyM6916-Jul-08 8:29 
QuestionCreating An Array of Stats from a DataTable Pin
Jammer15-Jul-08 10:53
Jammer15-Jul-08 10:53 
AnswerRe: Creating An Array of Stats from a DataTable Pin
Pete O'Hanlon15-Jul-08 11:03
mvePete O'Hanlon15-Jul-08 11:03 
GeneralRe: Creating An Array of Stats from a DataTable Pin
Jammer15-Jul-08 11:28
Jammer15-Jul-08 11:28 
GeneralRe: Creating An Array of Stats from a DataTable Pin
Jammer15-Jul-08 14:21
Jammer15-Jul-08 14:21 
GeneralRe: Creating An Array of Stats from a DataTable Pin
Pete O'Hanlon15-Jul-08 22:23
mvePete O'Hanlon15-Jul-08 22:23 
GeneralRe: Creating An Array of Stats from a DataTable Pin
Jammer16-Jul-08 0:49
Jammer16-Jul-08 0:49 
GeneralRe: Creating An Array of Stats from a DataTable Pin
Jammer16-Jul-08 8:38
Jammer16-Jul-08 8:38 
QuestionC# Raw IP Address Pin
DwR15-Jul-08 9:19
DwR15-Jul-08 9:19 
AnswerRe: C# Raw IP Address Pin
Pete O'Hanlon15-Jul-08 9:27
mvePete O'Hanlon15-Jul-08 9:27 
GeneralRe: C# Raw IP Address Pin
DwR15-Jul-08 12:05
DwR15-Jul-08 12:05 
GeneralRe: C# Raw IP Address Pin
Colin Angus Mackay15-Jul-08 13:32
Colin Angus Mackay15-Jul-08 13:32 
GeneralRe: C# Raw IP Address Pin
DwR15-Jul-08 13:48
DwR15-Jul-08 13:48 
QuestionSearch from rtb1 and delete if rtb2 contains rtb1 Pin
Stricter15-Jul-08 8:35
Stricter15-Jul-08 8:35 
AnswerRe: Search from rtb1 and delete if rtb2 contains rtb1 Pin
Pete O'Hanlon15-Jul-08 9:18
mvePete O'Hanlon15-Jul-08 9:18 
GeneralRe: Search from rtb1 and delete if rtb2 contains rtb1 Pin
Stricter15-Jul-08 10:48
Stricter15-Jul-08 10:48 
GeneralRe: Search from rtb1 and delete if rtb2 contains rtb1 Pin
Pete O'Hanlon15-Jul-08 10:54
mvePete O'Hanlon15-Jul-08 10:54 

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.