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

C#

 
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 
AnswerRe: C# 2010 string PinPopular
Richard MacCutchan21-Jun-12 22:40
mveRichard MacCutchan21-Jun-12 22:40 
AnswerRe: C# 2010 string Pin
BobJanova22-Jun-12 3:34
BobJanova22-Jun-12 3:34 
AnswerRe: C# 2010 string Pin
ernesto fazolo22-Jun-12 7:02
ernesto fazolo22-Jun-12 7:02 
QuestionWindows media Player sound output Pin
DArkiii21-Jun-12 7:49
DArkiii21-Jun-12 7:49 
QuestionCurrent process information Pin
a.fatemeh21-Jun-12 4:44
a.fatemeh21-Jun-12 4:44 
AnswerRe: Current process information Pin
Luc Pattyn21-Jun-12 5:27
sitebuilderLuc Pattyn21-Jun-12 5:27 
GeneralRe: Current process information Pin
a.fatemeh21-Jun-12 6:09
a.fatemeh21-Jun-12 6:09 
AnswerRe: Current process information Pin
markovl21-Jun-12 7:14
markovl21-Jun-12 7:14 
GeneralRe: Current process information Pin
a.fatemeh21-Jun-12 7:28
a.fatemeh21-Jun-12 7:28 
AnswerRe: Current process information Pin
markovl21-Jun-12 7:46
markovl21-Jun-12 7:46 
Questionstore SQLite file Pin
nike0721-Jun-12 3:06
nike0721-Jun-12 3:06 

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.