473,385 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

example please of how to use Array.Exists method

Tim

Dim Animals as String() = {"cat", "dog", "mouse", "rat"}

Can the Exists or Find method be used to determine if the Animals array
contains "mouse" ?

If Animals.Exists(....

or

Animals.Find(...

I get a compiler error: Type argument inferred from the argument passed
to parameter 'match'conflicts with the type argument inferred from the
argument passed to parameter 'array'.

Thanks
Tim

Aug 13 '07 #1
2 12263
Tim wrote:
>
Dim Animals as String() = {"cat", "dog", "mouse", "rat"}

Can the Exists or Find method be used to determine if the Animals array
contains "mouse" ?

If Animals.Exists(....

or

Animals.Find(...
The methods can be used for that, but not that way. The Exists and Find
method are static, so it would be:

found = Array.Exists(Animals, ... )

and

animal = Array.Find(Animals, ... )
I get a compiler error: Type argument inferred from the argument passed
to parameter 'match'conflicts with the type argument inferred from the
argument passed to parameter 'array'.
That means that the type of the array doesn't match the argument in your
predicate. If you show a bit of the code, someone might be able to help
you with it.

--
Göran Andersson
_____
http://www.guffa.com
Aug 13 '07 #2
Hi Tim,.

This one you can solve with the array indexof

http://msdn2.microsoft.com/en-us/library/7eddebat.aspx

My advice is to investigate all kind of indexof methods, there are much and
really very powerful.

Cor

"Tim" <an**@anon.comschreef in bericht
news:OY**************@TK2MSFTNGP03.phx.gbl...
>
Dim Animals as String() = {"cat", "dog", "mouse", "rat"}

Can the Exists or Find method be used to determine if the Animals array
contains "mouse" ?

If Animals.Exists(....

or

Animals.Find(...

I get a compiler error: Type argument inferred from the argument passed to
parameter 'match'conflicts with the type argument inferred from the
argument passed to parameter 'array'.

Thanks
Tim
Aug 13 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Mike S. Nowostawsky | last post by:
I tried using the "toUpperCase()" property to change the value of an array entity to uppercase BUT it tells me that the property is invalid. It seems that an array is not considered an object when...
23
by: Alberto | last post by:
An OUTSTANDING example of a rebuttal. Worth a glance. Rather long, OBVIOUSLY feel fee to dismiss it entirely if not interested. But this habit of the rebuttals must go to a stop (forgive odd...
13
by: J. J. Cale | last post by:
I have the following. There must be something less cumbersome without push pop. The function parameter obj is the event.srcElement and has the attributes(properties?) picNum and alb pinned to it....
47
by: VK | last post by:
Or why I just did myArray = "Computers" but myArray.length is showing 0. What a hey? There is a new trend to treat arrays and hashes as they were some variations of the same thing. But they...
15
by: deko | last post by:
What I'd like to do is create an array of values and test for existence of those values. Here's the non-working code I'm having trouble with: Dim wcSearch(4 To 7) As Integer If Me.Value =...
26
by: Martin Jřrgensen | last post by:
Hi, I don't understand these errors I get: g++ Persort.cpp Persort.cpp: In function 'int main()': Persort.cpp:43: error: name lookup of 'j' changed for new ISO 'for' scoping Persort.cpp:37:...
45
by: VK | last post by:
(see the post by ASM in the original thread; can be seen at <http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/3716384d8bfa1b0b> as an option) As that is not in relevance to...
9
by: weidongtom | last post by:
Hi, I've written the code that follows, and I use the function add_word(), it seems to work fine *before* increase_arrays() is called that uses realloc() to allocate more memory to words. But...
3
by: d d | last post by:
I have a large object with many sub-objects. They may go down 4 or 5 levels and I'm not sure how best to code a method that does operations on that data. Here's an attempt to make it an isolated...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.