View Single Post
Old 10-29-2006, 12:53 AM   #13 (permalink)
Courageous
Forum Expert
 
Courageous's Avatar
 
Join Date: Nov 2005
Location: San Diego, CA
Posts: 1,824
Default

Contatenating the strings is relatively expensive.

Checking for ==/!= is one instruction, even for strings, because C# strings are internalized. An internalized string is essentially a pointer to a string in a table, such that, at any given time, two strings that are spelled the same are actually the same object. If they have the same address, they are the same string, and if they don't, they aren't. So C# just compares their (internal) memory addresses. One instruction for that, basically. Very fast.

Hacking the strings together prolly isn't a good idea. Some set of ifs is the right way to do this.

C//
Courageous is offline   Reply With Quote