Click here to Skip to main content
15,902,026 members
Home / Discussions / C#
   

C#

 
AnswerRe: Restrict Access To DLL Pin
Luc Pattyn24-Nov-10 12:36
sitebuilderLuc Pattyn24-Nov-10 12:36 
QuestionHow can I make a line.Contains(searchString) case insensitive? Pin
turbosupramk324-Nov-10 2:00
turbosupramk324-Nov-10 2:00 
AnswerRe: How can I make a line.Contains(searchString) case insensitive? Pin
J4amieC24-Nov-10 2:09
J4amieC24-Nov-10 2:09 
GeneralRe: How can I make a line.Contains(searchString) case insensitive? Pin
turbosupramk324-Nov-10 2:23
turbosupramk324-Nov-10 2:23 
AnswerRe: How can I make a line.Contains(searchString) case insensitive? Pin
PIEBALDconsult24-Nov-10 2:10
mvePIEBALDconsult24-Nov-10 2:10 
GeneralRe: How can I make a line.Contains(searchString) case insensitive? Pin
J4amieC24-Nov-10 4:01
J4amieC24-Nov-10 4:01 
GeneralRe: How can I make a line.Contains(searchString) case insensitive? Pin
PIEBALDconsult24-Nov-10 13:47
mvePIEBALDconsult24-Nov-10 13:47 
AnswerRe: How can I make a line.Contains(searchString) case insensitive? Pin
Manfred Rudolf Bihy24-Nov-10 2:27
professionalManfred Rudolf Bihy24-Nov-10 2:27 
First define an IEqualityComparer like this:

class CharEqualityComparer : IEqualityComparer<Char>
{
    bool ignoreCase;

    pubilc CharEqualityComparer(bool ignoreCase)
    {
        this.ignoreCase = ignoreCase;
    }

    pubilc CharEqualityComparer() : this(false);
    {
    }


    public bool Equals(Char c1, Char c2)
    {
        c1 = (ignoreCase) ? c1.ToString().ToLower().ToCharArray()[0] : c1;
        c2 = (ignoreCase) ? c2.ToString().ToLower().ToCharArray()[0] : c2;
        if (c1 == c2)
        {
            return true;
        }
        else
        {
            return false;
        }
    }


    public int GetHashCode(Char c)
    {
        int hCode = (int)c;
        return hCode.GetHashCode();
    }

}


and then do this in your code

if (line.Contains(searchString, new CharEqualityComparer(true)))


Hope this helps!

Cheers

Manfred
GeneralRe: How can I make a line.Contains(searchString) case insensitive? Pin
Luc Pattyn24-Nov-10 3:31
sitebuilderLuc Pattyn24-Nov-10 3:31 
GeneralRe: How can I make a line.Contains(searchString) case insensitive? Pin
J4amieC24-Nov-10 4:04
J4amieC24-Nov-10 4:04 
GeneralRe: How can I make a line.Contains(searchString) case insensitive? Pin
Manfred Rudolf Bihy24-Nov-10 4:06
professionalManfred Rudolf Bihy24-Nov-10 4:06 
AnswerRe: How can I make a line.Contains(searchString) case insensitive? Pin
#realJSOP24-Nov-10 23:59
professional#realJSOP24-Nov-10 23:59 
QuestionSaving stream from IP camera Pin
koleraba24-Nov-10 0:59
koleraba24-Nov-10 0:59 
AnswerRe: Saving stream from IP camera Pin
JF201524-Nov-10 1:15
JF201524-Nov-10 1:15 
GeneralRe: Saving stream from IP camera Pin
koleraba24-Nov-10 2:09
koleraba24-Nov-10 2:09 
QuestionHow to manage city,state and country fields in drop down online Pin
sumit703423-Nov-10 23:01
sumit703423-Nov-10 23:01 
AnswerRe: How to manage city,state and country fields in drop down online Pin
J4amieC23-Nov-10 23:20
J4amieC23-Nov-10 23:20 
GeneralRe: How to manage city,state and country fields in drop down online Pin
sumit703423-Nov-10 23:28
sumit703423-Nov-10 23:28 
AnswerRe: How to manage city,state and country fields in drop down online Pin
PIEBALDconsult24-Nov-10 16:05
mvePIEBALDconsult24-Nov-10 16:05 
Questionc# controlbox and window menu Pin
Zeyad Jalil23-Nov-10 22:35
professionalZeyad Jalil23-Nov-10 22:35 
AnswerRe: c# controlbox and window menu Pin
Pete O'Hanlon24-Nov-10 3:32
mvePete O'Hanlon24-Nov-10 3:32 
QuestionHOWTO: start, get partial output and kill a console application from c# Pin
jancg23-Nov-10 22:06
jancg23-Nov-10 22:06 
AnswerRe: HOWTO: start, get partial output and kill a console application from c# Pin
Fla_Golfr23-Nov-10 22:38
professionalFla_Golfr23-Nov-10 22:38 
GeneralRe: HOWTO: start, get partial output and kill a console application from c# Pin
jancg23-Nov-10 23:05
jancg23-Nov-10 23:05 
AnswerRe: HOWTO: start, get partial output and kill a console application from c# Pin
Luc Pattyn24-Nov-10 3:36
sitebuilderLuc Pattyn24-Nov-10 3:36 

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.