.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

Fix lenth for array dimention

Posted By: Catherine     Posted Date: June 10, 2011    Points:5   Category :C#
Hi I am using array like this string[] strstring = new string[4];

now i would like to do if(strstring[2].length=5)
{

}
if this condition true only i would like to process other thing

but it is not working.the third array should be 5 character. please tell

Responses
Author: Gowthammanju             
Posted Date: June 10, 2011     Points: 20   

Hey

go through this link

http://www.c-sharpcorner.com/uploadfile/mahesh/workingwitharrays11232005064036am/workingwitharrays.aspx

whick might help u

Thanks & Regards,
GowthamManju
Chennai



Mark if the answer is true
Author: SureshM             
Posted Date: June 10, 2011     Points: 20   

Hi Catherine ,

If you set the array size is 4, array index will be like this: strstring[0].,.,.strstring[3]

I think you, u need to check the length of the second index. so use like this strstring[1]

if(strstring[1].Length == 5)
{
//do ur process here.
}

Author: Sasi Prabhu             
Posted Date: June 10, 2011     Points: 20   

it works fine...
use breakpoint and check the runtime value...

Thanks & Regards,
Sasi Prabhu.


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend