Support for null char in strings

Is there any support for using the null character, i.e. “\0”, in strings? I find it seems to act like a C string and not like the C# grammar. Here is an example that loops forever at the spot indicated, it prints this debug output when run on a panda:


public class Program
    {
        public static void Main()
        {
            char[] testChars = new char[] { '1', '2', '3', '4', '\n', '1', '2', '3', '4' };
            char[] testChars2 = new char[] { '1', '2', '3', '4', '\0', '1', '2', '3', '4' };
            Debug.Print(string.Concat("Created string 1: ", GetString(testChars)));
            Debug.Print(string.Concat("Created string 2: ", GetString(testChars2)));
        }

        public static string GetString(char[] from)
        {
            string toRet = new string(from);
            while (toRet.Length < from.Length)
            {
                //stays in this loop forever
                toRet = string.Concat(toRet, "\0", new string(from, toRet.Length + 1, from.Length - (toRet.Length + 1)));
            }
            return toRet;
        }
    }

This was brought up by someone years ago. From what you are saying this is still not supported. I haven’t tested it myself.

You can open a bug/feature request on NETMF on codeplex if this is something you see important