Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to get item count in string array of length 50 with value only....
Posted
Comments
Naz_Firdouse 15-Apr-13 3:43am    
can you show some sample of your array?

try this
C#
string[] str = { "123", "12345", "1234", "123456789", "123456789" };
          var result = str.Count(x => x.Length >= 50);
 
Share this answer
 
Comments
johannesnestler 15-Apr-13 9:05am    
Maybe this is what OP wanted - i guess...
Hello,

You can use Enumerable Count. Supported in 3.5, 4 & 4.5 version of .NET.
C#
int result = strArray.Count(s => s != null);

Regards,
 
Share this answer
 
Comments
johannesnestler 15-Apr-13 9:05am    
This Counts all strings in the Array not null - nothing wrong with this, just OP didn't ask for it (Altough it's hard to tell what OP really wants ;-))
Prasad Khandekar 15-Apr-13 10:14am    
Thanks Johan,

I purposely left that, so that OP will get a chance to explore it in more detail. I have also included the link for him.

Regards,

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