String is Immutable. Is it good to do ToLower since it creates a new copy of the string in memory.The ultimate goal is to get a match from the switch. Trim as well as ToLower both return a new copy of the string and don't change the original. The switch gets a reference to the final result from ToLower and all is well. The cost of the new strings is negligible and conveniently cleaned up by garbage collection almost immediately.
Is there any better option to eliminate such situations?
William Wegerson (www.OmegaCoder.Com)