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

C#

 
QuestionWeb Cam Problem Pin
S K Y8-Jun-09 5:23
S K Y8-Jun-09 5:23 
AnswerRe: Web Cam Problem Pin
DaveyM698-Jun-09 5:31
professionalDaveyM698-Jun-09 5:31 
AnswerRe: Web Cam Problem Pin
Simon P Stevens8-Jun-09 5:38
Simon P Stevens8-Jun-09 5:38 
QuestionHow to embed a internet explorer in a webbrowser control using c# Pin
Yukivi8-Jun-09 5:08
Yukivi8-Jun-09 5:08 
QuestionCast where XML file defines what integer and floating point values should be cast to. Pin
Dennis Lerche8-Jun-09 4:10
Dennis Lerche8-Jun-09 4:10 
AnswerRe: Cast where XML file defines what integer and floating point values should be cast to. Pin
led mike8-Jun-09 5:08
led mike8-Jun-09 5:08 
GeneralRe: Cast where XML file defines what integer and floating point values should be cast to. Pin
Dennis Lerche8-Jun-09 9:52
Dennis Lerche8-Jun-09 9:52 
GeneralRe: Cast where XML file defines what integer and floating point values should be cast to. Pin
Dennis Lerche8-Jun-09 23:36
Dennis Lerche8-Jun-09 23:36 
QuestionHow to count a character in a string? Pin
SimpleData8-Jun-09 3:47
SimpleData8-Jun-09 3:47 
AnswerRe: How to count a character in a string? Pin
PIEBALDconsult8-Jun-09 3:52
mvePIEBALDconsult8-Jun-09 3:52 
AnswerRe: How to count a character in a string? Pin
Blue_Boy8-Jun-09 3:54
Blue_Boy8-Jun-09 3:54 
GeneralRe: How to count a character in a string? Pin
Luc Pattyn8-Jun-09 4:50
sitebuilderLuc Pattyn8-Jun-09 4:50 
AnswerRe: How to count a character in a string? Pin
Manas Bhardwaj8-Jun-09 3:54
professionalManas Bhardwaj8-Jun-09 3:54 
GeneralRe: How to count a character in a string? Pin
SimpleData8-Jun-09 4:10
SimpleData8-Jun-09 4:10 
AnswerRe: How to count a character in a string? Pin
Skymir8-Jun-09 4:17
Skymir8-Jun-09 4:17 
GeneralRe: How to count a character in a string? Pin
Blue_Boy8-Jun-09 4:26
Blue_Boy8-Jun-09 4:26 
AnswerRe: How to count a character in a string? [modified] Pin
Luc Pattyn8-Jun-09 4:51
sitebuilderLuc Pattyn8-Jun-09 4:51 
GeneralRe: How to count a character in a string? Pin
harold aptroot8-Jun-09 5:52
harold aptroot8-Jun-09 5:52 
GeneralRe: How to count a character in a string? Pin
Luc Pattyn8-Jun-09 7:17
sitebuilderLuc Pattyn8-Jun-09 7:17 
Hi Harold,

I ran some tests (VS C# 2008, all release build), and the general conclusions are:
- optimum tactic depends on the data, mostly on the fraction of special characters (';') present;
- with lots of ';' the explicit loops are better;
- with few or no ';' string methods are better;
- my single-line approach based on string.Replace never wins;
- when string.Length is present in the for statement, it consumes >30% of the CPU cycles;
- with fewer than 15% of special chars, the winner is IndexOf (see below); for extemely long strings it is up to 4 times faster than the second fastest (explicit loop without Length in for statement).

int n=0;
int start=0;
for (; ; ) {
    int j=test.IndexOf(';', start);
    if (j<0) break;
    n++;
    start=j+1;
}


Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.

GeneralRe: How to count a character in a string? Pin
harold aptroot8-Jun-09 7:45
harold aptroot8-Jun-09 7:45 
Questionzedgraph Pin
yankoon8-Jun-09 3:06
yankoon8-Jun-09 3:06 
QuestionDynamically adding checkboxes in datagridview. Pin
deepseeindeepsy8-Jun-09 3:02
deepseeindeepsy8-Jun-09 3:02 
AnswerRe: Dynamically adding checkboxes in datagridview. Pin
yankoon8-Jun-09 3:11
yankoon8-Jun-09 3:11 
GeneralRe: Dynamically adding checkboxes in datagridview. Pin
deepseeindeepsy8-Jun-09 19:11
deepseeindeepsy8-Jun-09 19:11 
QuestionEXCEPTIONN: Request for the permission of type 'System.Configuration.ConfigurationPermission, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed Pin
Ashwanth Sreedharan8-Jun-09 1:34
Ashwanth Sreedharan8-Jun-09 1:34 

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.