Wrox Programmer Forums
|
BOOK: Beginning Visual C# 2010
This is the forum to discuss the Wrox book Beginning Visual C# 2010 by Karli Watson, Christian Nagel, Jacob Hammer Pedersen, Jon D. Reid, Morgan Skinner, ; ISBN: 9780470502266
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Visual C# 2010 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 17th, 2011, 08:58 AM
Authorized User
 
Join Date: Sep 2011
Posts: 24
Thanks: 7
Thanked 0 Times in 0 Posts
Default String manipulation

In page 116
Code:
string mystring="A string";
char [] myChars=myString.ToCharArray();
In the next line
Code:
foreach(char characters in myString)
{
console.writeline("{0}",character);
}
In foreach loop how myString comes,is it myChars
 
Old December 17th, 2011, 09:13 AM
Wrox Author
 
Join Date: Sep 2010
Posts: 175
Thanks: 3
Thanked 53 Times in 53 Posts
Default

Quote:
Originally Posted by arun_babu_a View Post
In page 116
Code:
string mystring="A string";
char [] myChars=myString.ToCharArray();
In the next line
Code:
foreach(char characters in myString)
{
console.writeline("{0}",character);
}
In foreach loop how myString comes,is it myChars
What do you mean with the myString comes as myChars? How does the foreach loop relate with the myChars variable declared earlier? There's no relation to that, the variable myChars is not used in the foreach statement.
And you should get an compile-time error as first a variable characters is declared with the foreach loop, and then the variable character is used.
__________________
Christian
CN innovation
Visit my blog at: csharp.christiannagel.com
Follow me on twitter: @christiannagel





Similar Threads
Thread Thread Starter Forum Replies Last Post
string manipulation alienaheart ASP.NET 2.0 Professional 1 February 5th, 2010 06:58 PM
String manipulation Franco1 Visual Basic 2005 Basics 1 July 16th, 2008 12:53 PM
String manipulation john316 SQL Language 1 October 1st, 2007 04:24 PM
String Manipulation twsinc Access 3 February 23rd, 2004 09:57 AM
String Manipulation Ben Access VBA 2 July 8th, 2003 05:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.