Click here to Skip to main content
15,886,666 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
list is contains lots of mobile number when i send the msg to number then check the number in exists in list or exists then directly send
Posted
Comments
DontWasteMyTime 14-Apr-15 2:03am    
you get it by comparing the number to check to the number on the list.

just simply create a loop that get the max of your LIST like list.rows.count or list.count then create a loop that will continue to loop until it got to list.count. then inside the loop do a IF statement ex: If txtToCheck.text = list.items("index of your loop").value then send
Member 11191738 14-Apr-15 2:14am    
please explain
Member 11191738 14-Apr-15 2:29am    
i get count from list but how to compare and find
Sergey Alexandrovich Kryukov 14-Apr-15 2:31am    
Consider using dictionary or hash map, depending on what else do you want from the collection. The complexity of O(1) is always better...
—SA
Member 11191738 14-Apr-15 2:41am    
I DONT Understand
plz explain

Try
bool alreadyExists = myList.Any(x=> x.mobileNumber==mobileNoToSearch);
if (alreadyExists) {
  //Do sending stuff
}
 
Share this answer
 
v3
Comments
Member 11191738 14-Apr-15 2:16am    
i try this but does not return exists number
Abhinav S 14-Apr-15 2:20am    
Did you check if the number has spaces or some other characters that are not present in the list?
Member 11191738 14-Apr-15 2:22am    
yahh all number are separated by comma
or try (if working with List)

XML
List<string> list=new List<string>();
bool isInList=list.Contains("some string");
 
Share this answer
 
v2
List<string> mobiles = new List<string>() {"077777777", "0777777778"};
if (mobiles.Contains("077777779"))
   {
   ...
   }
 
Share this answer
 
C#
var user = UserList.FirstOrDefault(u => u.MobileNumber==mobileNoToSearch);
if(user!=null)
{
//do something
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900