Click here to Skip to main content
15,903,175 members
Home / Discussions / C#
   

C#

 
AnswerRe: Error in Messagebox solution Pin
Dave Kreskowiak14-Oct-12 3:58
mveDave Kreskowiak14-Oct-12 3:58 
QuestionProblem with OpenCvSharp Pin
Daniel Heinsohn13-Oct-12 11:54
Daniel Heinsohn13-Oct-12 11:54 
AnswerRe: Problem with OpenCvSharp Pin
Eddy Vluggen14-Oct-12 0:40
professionalEddy Vluggen14-Oct-12 0:40 
GeneralRe: Problem with OpenCvSharp Pin
Daniel Heinsohn14-Oct-12 14:01
Daniel Heinsohn14-Oct-12 14:01 
QuestionRe: Problem with OpenCvSharp Pin
Eddy Vluggen15-Oct-12 0:08
professionalEddy Vluggen15-Oct-12 0:08 
Questionwant to see 1page when MDI use. Pin
Subhajit00113-Oct-12 6:15
Subhajit00113-Oct-12 6:15 
AnswerRe: want to see 1page when MDI use. Pin
Dave Kreskowiak13-Oct-12 7:02
mveDave Kreskowiak13-Oct-12 7:02 
QuestionDrawing a 3D polygon from coordinates (KML) Pin
tokano13-Oct-12 5:20
tokano13-Oct-12 5:20 
AnswerRe: Drawing a 3D polygon from coordinates (KML) Pin
Dave Kreskowiak13-Oct-12 7:07
mveDave Kreskowiak13-Oct-12 7:07 
GeneralRe: Drawing a 3D polygon from coordinates (KML) Pin
tokano13-Oct-12 12:10
tokano13-Oct-12 12:10 
GeneralRe: Drawing a 3D polygon from coordinates (KML) Pin
Dave Kreskowiak13-Oct-12 12:39
mveDave Kreskowiak13-Oct-12 12:39 
QuestionHow to Display fingerprint images from fingerprint Device ? Pin
osama_hagrass13-Oct-12 5:18
osama_hagrass13-Oct-12 5:18 
AnswerRe: How to Display fingerprint images from fingerprint Device ? Pin
Dave Kreskowiak13-Oct-12 6:59
mveDave Kreskowiak13-Oct-12 6:59 
Questioncalling a non static method from a static method in a dll class Pin
Fred 3413-Oct-12 0:35
Fred 3413-Oct-12 0:35 
AnswerRe: calling a non static method from a static method in a dll class Pin
n.podbielski13-Oct-12 1:49
n.podbielski13-Oct-12 1:49 
GeneralRe: calling a non static method from a static method in a dll class Pin
Fred 3413-Oct-12 2:39
Fred 3413-Oct-12 2:39 
GeneralRe: calling a non static method from a static method in a dll class Pin
n.podbielski13-Oct-12 2:48
n.podbielski13-Oct-12 2:48 
QuestionArray.Contains Pin
ASPnoob12-Oct-12 20:14
ASPnoob12-Oct-12 20:14 
AnswerRe: 5C# 2008 Array.Contains Pin
n.podbielski12-Oct-12 20:19
n.podbielski12-Oct-12 20:19 
AnswerRe: Array.Contains Pin
Shameel12-Oct-12 22:50
professionalShameel12-Oct-12 22:50 
GeneralRe: Array.Contains Pin
ASPnoob13-Oct-12 0:13
ASPnoob13-Oct-12 0:13 
GeneralRe: Array.Contains Pin
Shameel13-Oct-12 4:24
professionalShameel13-Oct-12 4:24 
AnswerRe: Array.Contains Pin
KiranKumar Roy14-Oct-12 1:04
KiranKumar Roy14-Oct-12 1:04 
GeneralRe: Array.Contains Pin
DaveyM6914-Oct-12 9:47
professionalDaveyM6914-Oct-12 9:47 
KiranKumar Roy wrote:
You can use below function to check if Value exist in array or not

Not really. This is the C# forum, you have posted VB code. You are checking for a string, the OP could be searching for any type of data. You are searching an array that is created inside the method, typically he would be searching a class level variable or passing an array to a static method.

Array.IndexOf or Array.IndexOf<T> are a good call though, but no need to wrap in another method.

If you really want a separate method then extensions such as these would be better IMO:
C#
public static class Extensions
{
    public static bool Contains(this object[] array, object value)
    {
        bool result = false;
        if (array != null)
            result = Array.IndexOf(array, value) > -1;
        return result;
    }
    public static bool Contains<T>(this T[] array, T value)
    {
        bool result = false;
        if (array != null)
            result = Array.IndexOf<T>(array, value) > -1;
        return result;
    }
}

Dave

Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.
Astonish us. Be exceptional. (Pete O'Hanlon)

BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)




modified 14-Oct-12 16:01pm.

GeneralRe: Array.Contains Pin
KiranKumar Roy14-Oct-12 19:03
KiranKumar Roy14-Oct-12 19:03 

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.