Click here to Skip to main content
15,904,023 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to call C++ parameterised function from C# using thread Pin
Richard MacCutchan4-Nov-12 5:14
mveRichard MacCutchan4-Nov-12 5:14 
AnswerRe: How to call C++ parameterised function from C# using thread Pin
DaveyM694-Nov-12 5:29
professionalDaveyM694-Nov-12 5:29 
QuestionHow to declare events? Pin
Andy_L_J3-Nov-12 20:41
Andy_L_J3-Nov-12 20:41 
AnswerRe: How to declare events? Pin
Richard MacCutchan3-Nov-12 21:32
mveRichard MacCutchan3-Nov-12 21:32 
GeneralRe: How to declare events? Pin
Andy_L_J3-Nov-12 22:09
Andy_L_J3-Nov-12 22:09 
GeneralRe: How to declare events? Pin
Richard MacCutchan4-Nov-12 2:03
mveRichard MacCutchan4-Nov-12 2:03 
AnswerRe: How to declare events? Pin
OriginalGriff3-Nov-12 21:33
mveOriginalGriff3-Nov-12 21:33 
GeneralRe: How to declare events? Pin
Andy_L_J3-Nov-12 22:01
Andy_L_J3-Nov-12 22:01 
GeneralRe: How to declare events? Pin
OriginalGriff3-Nov-12 22:10
mveOriginalGriff3-Nov-12 22:10 
GeneralRe: How to declare events? Pin
Andy_L_J3-Nov-12 22:26
Andy_L_J3-Nov-12 22:26 
GeneralRe: How to declare events? Pin
OriginalGriff3-Nov-12 22:32
mveOriginalGriff3-Nov-12 22:32 
GeneralRe: How to declare events? Pin
DaveyM694-Nov-12 5:46
professionalDaveyM694-Nov-12 5:46 
GeneralRe: How to declare events? Pin
Andy_L_J4-Nov-12 12:37
Andy_L_J4-Nov-12 12:37 
GeneralRe: How to declare events? Pin
DaveyM694-Nov-12 19:23
professionalDaveyM694-Nov-12 19:23 
QuestionC# Search Button Pin
MikeK322-Nov-12 10:57
MikeK322-Nov-12 10:57 
AnswerRe: C# Search Button Pin
fjdiewornncalwe2-Nov-12 11:19
professionalfjdiewornncalwe2-Nov-12 11:19 
GeneralRe: C# Search Button Pin
MikeK322-Nov-12 11:23
MikeK322-Nov-12 11:23 
GeneralRe: C# Search Button Pin
fjdiewornncalwe2-Nov-12 11:26
professionalfjdiewornncalwe2-Nov-12 11:26 
GeneralRe: C# Search Button Pin
MikeK322-Nov-12 11:51
MikeK322-Nov-12 11:51 
GeneralRe: C# Search Button Pin
fjdiewornncalwe2-Nov-12 11:53
professionalfjdiewornncalwe2-Nov-12 11:53 
Questioncase insensitive string comparison - relative speed Pin
Blake Miller2-Nov-12 9:31
Blake Miller2-Nov-12 9:31 
AnswerRe: case insensitive string comparison - relative speed Pin
Eddy Vluggen2-Nov-12 9:43
professionalEddy Vluggen2-Nov-12 9:43 
Blake Miller wrote:
Under what conditions might the relative speed vary?
  • strings are reference-types, and atomic in memory
  • Converting them both before the comparison is slower than comparing them directly (there can be only one!)
  • Microsoft "advises" to use uppercase constants. Has something to do with efficiency in comparing.
  • Does it matter?

The last point is the most important one; readability is important, as it influences maintainability. If you're doing a lot of string-operations, consider a RegEx for the job.

-edit;
Many string operations, most important the Compare and Equals methods, now provide an overload that accepts a StringComparision enumeration value as a parameter.

When you specify either StringComparison.Ordinal or StringComparison.OrdinalIgnoreCase, the string comparison will be non-linguistic. That is, the features that are specific to the natural language are ignored when making comparison decisions. This means the decisions are based on simple byte comparisons and ignore casing or equivalence tables that are parameterized by culture. As a result, by explicitly setting the parameter to either the StringComparison.Ordinal or StringComparison.OrdinalIgnoreCase, your code often gains speed, increases correctness, and becomes more reliable.

It's one of FxCops' warnings[^] Smile | :)
Bastard Programmer from Hell Suspicious | :suss:
if you can't read my code, try converting it here[^]


modified 2-Nov-12 16:25pm.

GeneralRe: case insensitive string comparison - relative speed Pin
Blake Miller2-Nov-12 10:26
Blake Miller2-Nov-12 10:26 
GeneralRe: case insensitive string comparison - relative speed Pin
Eddy Vluggen2-Nov-12 10:29
professionalEddy Vluggen2-Nov-12 10:29 
GeneralRe: case insensitive string comparison - relative speed Pin
SledgeHammer012-Nov-12 11:20
SledgeHammer012-Nov-12 11:20 

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.