Actually i am working on a sample code of my own trail where i enter a mobile number and click on buttonso that a form will open on that form i would like to show the name of that coresponding number from the string[] array available in the form
Assume i have
string[] User = { "XYZ", "ABC", "DEF" };
string[] Number = { "1234567890", "2345678901", "345678901" };
Assume i enter 1234567890 and click on enter i would like to display the corresponding name from the list avialable i.e XYZ.
I don’t know whteher i explain my problem clearly or not but it is similar to the finding the contact available.
Any better method please let me know..
Use
Dictionary<long, string>is what you need here.Then to find the name of the inserted number you can do:
Edit: change the signature to long instead of int, thanks to @Kirill how pointed this out, Anyway I personally would use string instead so my method will accept more generic format of numbers such as
012-3456789