Click here to Skip to main content
15,920,468 members
Home / Discussions / C#
   

C#

 
GeneralRe: help Pin
EliottA3-Feb-09 7:04
EliottA3-Feb-09 7:04 
GeneralRe: help Pin
musefan3-Feb-09 7:06
musefan3-Feb-09 7:06 
GeneralRe: help Pin
Rob Philpott3-Feb-09 7:30
Rob Philpott3-Feb-09 7:30 
AnswerRe: help Pin
0x3c03-Feb-09 9:10
0x3c03-Feb-09 9:10 
Questionadding chars Pin
humayunlalzad3-Feb-09 6:45
humayunlalzad3-Feb-09 6:45 
AnswerRe: adding chars Pin
musefan3-Feb-09 6:53
musefan3-Feb-09 6:53 
GeneralRe: adding chars Pin
EliottA3-Feb-09 6:54
EliottA3-Feb-09 6:54 
AnswerRe: adding chars Pin
Wendelius3-Feb-09 8:36
mentorWendelius3-Feb-09 8:36 
The meaning of + operator depends on the types added together.

"A char can be implicitly converted to ushort, int, uint, long, ulong, float, double, or decimal. However, there are no implicit conversions from other types to the char type"

For chars the + is adding the integers together that are used for representing a single char. So in your first line the result is an int.

The second line contains automatically assignment so the result type cannot change (since you don't have an intermediate result) thus the operation results to a char. In the line having an error you must do casting explicitely to the intermediate result.

The need to optimize rises from a bad design.My articles[^]

GeneralRe: adding chars Pin
humayunlalzad4-Feb-09 4:43
humayunlalzad4-Feb-09 4:43 
GeneralRe: adding chars Pin
Wendelius4-Feb-09 7:59
mentorWendelius4-Feb-09 7:59 
QuestionNoob question, probably easy answer... Pin
Lodeclaw3-Feb-09 6:14
Lodeclaw3-Feb-09 6:14 
AnswerRe: Noob question, probably easy answer... Pin
EliottA3-Feb-09 6:15
EliottA3-Feb-09 6:15 
GeneralRe: Noob question, probably easy answer... Pin
Lodeclaw3-Feb-09 6:16
Lodeclaw3-Feb-09 6:16 
GeneralRe: Noob question, probably easy answer... Pin
EliottA3-Feb-09 6:20
EliottA3-Feb-09 6:20 
GeneralRe: Noob question, probably easy answer... Pin
Lodeclaw3-Feb-09 6:26
Lodeclaw3-Feb-09 6:26 
GeneralRe: Noob question, probably easy answer... Pin
EliottA3-Feb-09 6:27
EliottA3-Feb-09 6:27 
GeneralRe: Noob question, probably easy answer... Pin
EliottA3-Feb-09 6:28
EliottA3-Feb-09 6:28 
GeneralRe: Noob question, probably easy answer... Pin
Kristian Sixhøj3-Feb-09 6:21
Kristian Sixhøj3-Feb-09 6:21 
GeneralRe: Noob question, probably easy answer... Pin
EliottA3-Feb-09 6:23
EliottA3-Feb-09 6:23 
GeneralRe: Noob question, probably easy answer... Pin
Kristian Sixhøj3-Feb-09 6:28
Kristian Sixhøj3-Feb-09 6:28 
GeneralRe: Noob question, probably easy answer... Pin
EliottA3-Feb-09 6:30
EliottA3-Feb-09 6:30 
GeneralRe: Noob question, probably easy answer... Pin
Guffa3-Feb-09 10:07
Guffa3-Feb-09 10:07 
GeneralRe: Noob question, probably easy answer... Pin
Rob Philpott3-Feb-09 6:31
Rob Philpott3-Feb-09 6:31 
GeneralRe: Noob question, probably easy answer... Pin
Lodeclaw3-Feb-09 6:38
Lodeclaw3-Feb-09 6:38 
GeneralRe: Noob question, probably easy answer... Pin
EliottA3-Feb-09 6:39
EliottA3-Feb-09 6:39 

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.