LA.NET [EN]

April, 2011Archive

Apr 26

So, you know everything about text, right?–part VI

Posted in .NET, Basics, C#       Comments Off on So, you know everything about text, right?–part VI

In this post, we’ll talk a little bit about string interning. As I’ve pointed out before, strings are immutable. So, it’s fair to say that the following snippet ends up wasting memory because we should end up with two different instances that, for all practical purposes, represent the same string: var str1 = "hi"; var […]

Read the rest of this entry »

Apr 25

In the previous post I’ve said that we needed a small detour into cultures to conclude the linguistic string comparison section. In .NET, the CultureInfo type holds all the information regarding a specific culture. For example, any instance of CultureInfo will give the name or calendar of a specific culture. In .NET, each culture is […]

Read the rest of this entry »

Apr 25

So, you know everything about strings, right?–part IV

Posted in .NET, Basics, C#       Comments Off on So, you know everything about strings, right?–part IV

String comparison is one of the most common operations you’ll need to perform in your daily tasks. Besides checking for equality, you’ll also end up comparing strings whenever you need to sort them. The String type offers several methods for performing comparison operations: Equals: this instance method checks  two strings for equality, according with the […]

Read the rest of this entry »

Apr 24

In the latest post, we’ve seen that strings are immutable. At the time, I’ve mentioned that this brings several advantages, but there are also a couple of gotchas. For instance,  concatenating strings can be an expensive operation, especially when you have lots of strings. To solve this kind of problem, we need to resort to […]

Read the rest of this entry »