Click here to Skip to main content
15,898,035 members
Home / Discussions / C#
   

C#

 
QuestionCreating a sales Page in C#, simplest method Pin
Johnmc07122-Jun-12 3:05
Johnmc07122-Jun-12 3:05 
AnswerRe: Creating a sales Page in C#, simplest method Pin
Wes Aday22-Jun-12 4:02
professionalWes Aday22-Jun-12 4:02 
QuestionLooking for a good rules-based expert system engine (like drools). Suggestions? Pin
vValkir22-Jun-12 1:26
vValkir22-Jun-12 1:26 
AnswerRe: Looking for a good rules-based expert system engine (like drools). Suggestions? Pin
Pete O'Hanlon22-Jun-12 4:02
mvePete O'Hanlon22-Jun-12 4:02 
GeneralRe: Looking for a good rules-based expert system engine (like drools). Suggestions? Pin
vValkir22-Jun-12 4:08
vValkir22-Jun-12 4:08 
QuestionHow to download file from another website whose name is given in the <script> tag Pin
akhilgaur198821-Jun-12 23:56
akhilgaur198821-Jun-12 23:56 
AnswerRe: How to download file from another website whose name is given in the tag Pin
Bernhard Hiller22-Jun-12 2:00
Bernhard Hiller22-Jun-12 2:00 
QuestionMerge Data using Itext sharp Pin
Member 915535921-Jun-12 22:00
Member 915535921-Jun-12 22:00 
AnswerRe: Merge Data using Itext sharp Pin
Richard MacCutchan21-Jun-12 22:44
mveRichard MacCutchan21-Jun-12 22:44 
QuestioniTextsharp annotation problem Pin
candogu21-Jun-12 21:16
candogu21-Jun-12 21:16 
QuestionRe: iTextsharp annotation problem Pin
Richard MacCutchan21-Jun-12 22:42
mveRichard MacCutchan21-Jun-12 22:42 
AnswerRe: iTextsharp annotation problem Pin
Pete O'Hanlon21-Jun-12 23:36
mvePete O'Hanlon21-Jun-12 23:36 
QuestionDisplay large content in windows application Pin
Rajeev_8721-Jun-12 13:16
Rajeev_8721-Jun-12 13:16 
AnswerCROSSPOST Pin
Peter_in_278021-Jun-12 13:44
professionalPeter_in_278021-Jun-12 13:44 
QuestionC# 2010 string Pin
sc steinhayse21-Jun-12 12:07
sc steinhayse21-Jun-12 12:07 
AnswerRe: C# 2010 string PinPopular
Pete O'Hanlon21-Jun-12 12:12
mvePete O'Hanlon21-Jun-12 12:12 
AnswerRe: C# 2010 string PinPopular
Matt T Heffron21-Jun-12 12:15
professionalMatt T Heffron21-Jun-12 12:15 
GeneralRe: C# 2010 string Pin
Peter_in_278021-Jun-12 16:09
professionalPeter_in_278021-Jun-12 16:09 
GeneralRe: C# 2010 string Pin
Pete O'Hanlon21-Jun-12 22:28
mvePete O'Hanlon21-Jun-12 22:28 
GetFileName is a good choice, but it does have the limitation of that it is actually doing more than is necessary to solve this particular problem. Why is that you ask? Well, when we deconstruct the method, it actually does the following:
C#
public static string GetFileName(string path)
{
    if (path != null)
    {
        CheckInvalidPathChars(path);
        int length = path.Length;
        int num2 = length;
        while (--num2 >= 0)
        {
            char ch = path[num2];
            if (((ch == DirectorySeparatorChar) || (ch == AltDirectorySeparatorChar)) || (ch == VolumeSeparatorChar))
            {
                return path.Substring(num2 + 1, (length - num2) - 1);
            }
        }
    }
    return path;
}
As you can see, right at the top of the method, it's calling CheckInvalidPathChars to determine whether or not the path is valid. However, this is just a minor point - yours is a perfectly good solution, hence my 5.

*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

"Mind bleach! Send me mind bleach!" - Nagy Vilmos


CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

GeneralRe: C# 2010 string Pin
kishhr22-Jun-12 6:41
kishhr22-Jun-12 6:41 
GeneralMessage Closed Pin
22-Jun-12 9:45
mvePete O'Hanlon22-Jun-12 9:45 
GeneralRe: C# 2010 string Pin
Matty2224-Jun-12 19:32
Matty2224-Jun-12 19:32 
GeneralRe: C# 2010 string Pin
Pete O'Hanlon25-Jun-12 2:48
mvePete O'Hanlon25-Jun-12 2:48 
GeneralRe: C# 2010 string Pin
Matt T Heffron25-Jun-12 9:37
professionalMatt T Heffron25-Jun-12 9:37 
AnswerRe: C# 2010 string Pin
Abhinav S21-Jun-12 19:42
Abhinav S21-Jun-12 19: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.