Click here to Skip to main content
15,916,180 members
Home / Discussions / C#
   

C#

 
GeneralSorry Pin
Mircea Puiu12-Jan-07 4:38
Mircea Puiu12-Jan-07 4:38 
GeneralRe: Sorry Pin
ednrgc12-Jan-07 4:46
ednrgc12-Jan-07 4:46 
GeneralRe: Sorry Pin
Mircea Puiu12-Jan-07 4:51
Mircea Puiu12-Jan-07 4:51 
GeneralRe: ... just joking .... Pin
ednrgc12-Jan-07 4:45
ednrgc12-Jan-07 4:45 
GeneralRe: ... just joking .... Pin
Software_Specialist12-Jan-07 4:52
Software_Specialist12-Jan-07 4:52 
GeneralRe: ... just joking .... Pin
ednrgc12-Jan-07 4:57
ednrgc12-Jan-07 4:57 
GeneralRe: ... just joking .... Pin
Software_Specialist12-Jan-07 5:09
Software_Specialist12-Jan-07 5:09 
AnswerHave a look at this Pin
Mircea Puiu12-Jan-07 4:49
Mircea Puiu12-Jan-07 4:49 
GeneralRe: Have a look at this Pin
Software_Specialist12-Jan-07 4:56
Software_Specialist12-Jan-07 4:56 
GeneralRe: Have a look at this Pin
Mircea Puiu12-Jan-07 5:01
Mircea Puiu12-Jan-07 5:01 
QuestionTreeNode.FullPath Pin
zaboboa12-Jan-07 3:19
zaboboa12-Jan-07 3:19 
AnswerRe: TreeNode.FullPath Pin
Seishin#12-Jan-07 3:34
Seishin#12-Jan-07 3:34 
GeneralRe: TreeNode.FullPath Pin
zaboboa12-Jan-07 4:04
zaboboa12-Jan-07 4:04 
AnswerRe: TreeNode.FullPath Pin
Mircea Puiu12-Jan-07 4:07
Mircea Puiu12-Jan-07 4:07 
QuestionAssign items to DatagridView Combobox Cell Pin
Tyler4512-Jan-07 3:02
Tyler4512-Jan-07 3:02 
AnswerRe: Assign items to DatagridView Combobox Cell Pin
Tyler4512-Jan-07 3:54
Tyler4512-Jan-07 3:54 
QuestionLock ListView Colums Pin
Rapier50312-Jan-07 2:55
Rapier50312-Jan-07 2:55 
AnswerRe: Lock ListView Colums Pin
Mircea Puiu12-Jan-07 3:30
Mircea Puiu12-Jan-07 3:30 
QuestionCompare string and int Pin
szukuro12-Jan-07 2:26
szukuro12-Jan-07 2:26 
AnswerRe: Compare string and int Pin
Guffa12-Jan-07 2:41
Guffa12-Jan-07 2:41 
GeneralRe: Compare string and int [modified] Pin
szukuro12-Jan-07 3:27
szukuro12-Jan-07 3:27 
AnswerRe: Compare string and int Pin
Guffa14-Jan-07 12:15
Guffa14-Jan-07 12:15 
Well, if you only have one string value and a lot of integers, then you should obviously convert the string to an integer.

Look at the number of string operations that you have to do to using different methods. Integer comparisons are so cheap in comparison that they can be ignored.

If you convert the string to an integer, you have a single string operation. If you convert the integers to strings, you will have one string operation per value.


If you on the other hand had a single integer value to compare to a lot of strings:

If you convert each string to an integer and the compare the integers, you have one string operation per value. If you convert the integer value to a string and then compare that to each string, you have one string operation per value plus an additional string operation. In this case the methods will cost about the same.

---
Year happy = new Year(2007);

AnswerRe: Compare string and int Pin
Mircea Puiu12-Jan-07 2:41
Mircea Puiu12-Jan-07 2:41 
AnswerRe: Compare string and int Pin
CPallini12-Jan-07 2:42
mveCPallini12-Jan-07 2:42 
AnswerRe: Compare string and int Pin
Thomas Stockwell13-Jan-07 5:42
professionalThomas Stockwell13-Jan-07 5:42 

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.