Click here to Skip to main content
15,887,135 members
Home / Discussions / C#
   

C#

 
Questionstatic fields for threads in c# Pin
mr.mohsen10-Sep-07 5:04
mr.mohsen10-Sep-07 5:04 
AnswerRe: static fields for threads in c# Pin
PIEBALDconsult10-Sep-07 5:20
mvePIEBALDconsult10-Sep-07 5:20 
AnswerRe: static fields for threads in c# Pin
Luc Pattyn10-Sep-07 5:38
sitebuilderLuc Pattyn10-Sep-07 5:38 
QuestionHttpWebRequest Pin
smsmfe10-Sep-07 4:54
smsmfe10-Sep-07 4:54 
AnswerRe: HttpWebRequest Pin
led mike10-Sep-07 5:23
led mike10-Sep-07 5:23 
QuestionPath stripping algorithim.....help required Pin
c#_keithy10-Sep-07 4:37
c#_keithy10-Sep-07 4:37 
AnswerRe: Path stripping algorithim.....help required Pin
Judah Gabriel Himango10-Sep-07 4:59
sponsorJudah Gabriel Himango10-Sep-07 4:59 
AnswerRe: Path stripping algorithim.....help required Pin
Skippums10-Sep-07 5:15
Skippums10-Sep-07 5:15 
It will actually be faster to just go left to right, comparing each char as you go. When one of the chars varies, return the current string (as follows):


List<string> paths = new List<string>();
int shortestPathLength;
// Populate paths and shortestPathLength
if (paths.Count == 0) return string.Empty;
string result = string.Empty;
string tempResult = string.Empty;
for (int charIdx = 0; charIdx < shortestPathLength; ++charIdx) {
char c = paths[0][charIdx];
for (int pathIdx = 1; pathIdx < paths.Length; ++pathIdx) {
if (paths[pathIdx][charIdx] != c)
return result;
}
// Not sure if "DirectorySeparator" is the property, but you get the idea
if (c == Path.DirectorySeparator)
result = tempResult;
tempResult += c.ToString();
}
return tempResult;

Hope this helps!

Jeff
GeneralRe: Path stripping algorithim.....help required Pin
c#_keithy10-Sep-07 5:43
c#_keithy10-Sep-07 5:43 
GeneralRe: Path stripping algorithim.....help required Pin
Skippums10-Sep-07 5:48
Skippums10-Sep-07 5:48 
GeneralRe: Path stripping algorithim.....help required Pin
Guffa10-Sep-07 6:04
Guffa10-Sep-07 6:04 
GeneralRe: Path stripping algorithim.....help required Pin
Skippums10-Sep-07 7:06
Skippums10-Sep-07 7:06 
AnswerRe: Path stripping algorithim.....help required Pin
Luc Pattyn10-Sep-07 7:12
sitebuilderLuc Pattyn10-Sep-07 7:12 
GeneralRe: Path stripping algorithim.....help required Pin
Skippums10-Sep-07 8:22
Skippums10-Sep-07 8:22 
GeneralRe: Path stripping algorithim.....help required Pin
Luc Pattyn10-Sep-07 9:53
sitebuilderLuc Pattyn10-Sep-07 9:53 
GeneralRe: Path stripping algorithim.....help required Pin
Skippums10-Sep-07 10:08
Skippums10-Sep-07 10:08 
GeneralRe: Path stripping algorithim.....help required Pin
c#_keithy10-Sep-07 21:57
c#_keithy10-Sep-07 21:57 
QuestionHelp with DataGridViewTextBoxColumn Pin
gugulethun10-Sep-07 3:47
gugulethun10-Sep-07 3:47 
AnswerRe: Help with DataGridViewTextBoxColumn Pin
mr.mohsen10-Sep-07 4:57
mr.mohsen10-Sep-07 4:57 
QuestionWindow Service Error Pin
ramdil10-Sep-07 2:56
ramdil10-Sep-07 2:56 
AnswerRe: Window Service Error Pin
Nissim Salomon10-Sep-07 3:43
Nissim Salomon10-Sep-07 3:43 
GeneralRe: Window Service Error Pin
ramdil12-Sep-07 23:41
ramdil12-Sep-07 23:41 
QuestionNeed help with time math calculation Pin
RapGame200610-Sep-07 2:38
RapGame200610-Sep-07 2:38 
AnswerRe: Need help with time math calculation Pin
Colin Angus Mackay10-Sep-07 2:41
Colin Angus Mackay10-Sep-07 2:41 
GeneralRe: Need help with time math calculation Pin
RapGame200610-Sep-07 4:52
RapGame200610-Sep-07 4:52 

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.