Click here to Skip to main content
15,891,951 members
Home / Discussions / C#
   

C#

 
GeneralRe: USB driver communication in C# 2.0 Pin
Christian Graus8-Dec-05 19:10
protectorChristian Graus8-Dec-05 19:10 
GeneralRe: USB driver communication in C# 2.0 Pin
denpsia8-Dec-05 19:58
denpsia8-Dec-05 19:58 
GeneralRe: USB driver communication in C# 2.0 Pin
bouli8-Dec-05 20:16
bouli8-Dec-05 20:16 
GeneralRe: USB driver communication in C# 2.0 Pin
Dan Neely9-Dec-05 3:02
Dan Neely9-Dec-05 3:02 
Questionflicker on TableLayoutPanel Pin
savage_8-Dec-05 11:09
savage_8-Dec-05 11:09 
QuestionTernary Condition, compiler error. Pin
eggsovereasy8-Dec-05 10:52
eggsovereasy8-Dec-05 10:52 
AnswerRe: Ternary Condition, compiler error. Pin
Jon Sagara8-Dec-05 11:29
Jon Sagara8-Dec-05 11:29 
AnswerRe: Ternary Condition, compiler error. Pin
Dave Kreskowiak8-Dec-05 11:38
mveDave Kreskowiak8-Dec-05 11:38 
Basically, you can't do this. This is because you're evaluating an expression (bool?x:y) that is trying to return 2 different types, an object reference and int.

From the MSDN Gospel:

The second and third operands of the ?: operator control the type of the conditional expression. Let X and Y be the types of the second and third operands. Then,
    If X and Y are the same type, then this is the type of the conditional expression. 
 
    Otherwise, if an implicit conversion exists from X to Y, but not from Y
    to X, then Y is the type of the conditional expression. 
 
    Otherwise, if an implicit conversion exists from Y to X, but not from X
    to Y, then X is the type of the conditional expression.
 
    Otherwise, no expression type can be determined, and a compile-time error occurs.

What all this means, is that the compiler error occurs because there is no conversion possible between int and null. It looks like you'll have to do it using an if statement.




RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

AnswerRe: Ternary Condition, compiler error. Pin
leppie8-Dec-05 13:17
leppie8-Dec-05 13:17 
AnswerRe: Ternary Condition, compiler error. Pin
eggsovereasy12-Dec-05 10:48
eggsovereasy12-Dec-05 10:48 
Questionproblem with saving a picture as an icon Pin
g0ju8-Dec-05 10:18
g0ju8-Dec-05 10:18 
AnswerRe: problem with saving a picture as an icon Pin
NassosReyzidis9-Dec-05 0:31
NassosReyzidis9-Dec-05 0:31 
QuestionLightweight Collections Pin
OldDog.Net8-Dec-05 8:09
OldDog.Net8-Dec-05 8:09 
AnswerRe: Lightweight Collections Pin
Dave Kreskowiak8-Dec-05 11:18
mveDave Kreskowiak8-Dec-05 11:18 
QuestionAsyncronous WebRequest (race condition) Pin
usernameexists8-Dec-05 7:15
usernameexists8-Dec-05 7:15 
QuestionWriting to webpage from C# Pin
monrobot138-Dec-05 7:12
monrobot138-Dec-05 7:12 
AnswerRe: Writing to webpage from C# Pin
Rob Philpott8-Dec-05 7:58
Rob Philpott8-Dec-05 7:58 
GeneralRe: Writing to webpage from C# Pin
monrobot138-Dec-05 8:50
monrobot138-Dec-05 8:50 
GeneralRe: Writing to webpage from C# Pin
Rob Philpott8-Dec-05 9:13
Rob Philpott8-Dec-05 9:13 
GeneralRe: Writing to webpage from C# Pin
monrobot139-Dec-05 19:47
monrobot139-Dec-05 19:47 
GeneralRe: Writing to webpage from C# Pin
monrobot1310-Dec-05 20:17
monrobot1310-Dec-05 20:17 
GeneralRe: Writing to webpage from C# Pin
monrobot1310-Dec-05 20:46
monrobot1310-Dec-05 20:46 
AnswerRe: Writing to webpage from C# Pin
agileagent8-Dec-05 9:24
agileagent8-Dec-05 9:24 
QuestionBreak statement in C#. Pin
sacoskun8-Dec-05 6:47
sacoskun8-Dec-05 6:47 
AnswerRe: Break statement in C#. Pin
User 66588-Dec-05 7:00
User 66588-Dec-05 7:00 

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.