|
-
Mar 16th, 2005, 05:41 PM
#1
ToCharArray vs. String[i]
If I want to loop through the characters in a string, would it matter at all (as far as efficiency is concerned) whether I access the characters with brackets or if I convert the whole thing to a character array first and then access the characters?
ie:
string myStr = "MrPolite rules the world";
for (int i=0; i<myStr.Length; i++)
Console.WriteLine (myStr[i]);
vs.
string myStr = "MrPolite rules the world";
char[] chrs = myStr.ToCharArray();
for (int i=0; i<chrs.Length; i++)
Console.WriteLine (chrs[i]);
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|