Archive for September, 2008
Separator Delimited ToString for Array, List, Dictionary, Generic IEnumerable
By admin - Last updated: Sunday, September 21, 2008
Often programmers want to convert an array into one string with for example comma delimited.
Traditionally, in C#, it can be achieved by
int[] array = {1,2,3};
string delimited = string.Join(”,”, array);
Console.WriteLine(delimited ) // output: "1,2,3"
However, string.Join does not apply to any generic IEnumerable object. It would be so much easier if this method behavior could be [...]
C# Pointer in unsafe context
By admin - Last updated: Saturday, September 20, 2008
Pointer usage in C# in unsafe context
static unsafe void Main()
{
int i;
int[] array = { 11, 22, 33 };
// pointer pi has the address of variable i
int* pi = &i;
i = 0;
// dereference the pi, i.e. *pi is i
Console.WriteLine(”i = {0}”, [...]
