using System;
using System.Text;
using System.Collections.Generic;
// Unicode comment: δ½ ε₯½δΈ–η•Œ πŸŒπŸš€
public class EdgeCases
{
public static void Main()
{
// Unicode string literals
string unicode = "γ“γ‚“γ«γ‘γ―δΈ–η•Œ";
Console.WriteLine(unicode);
// Null byte embedded
string nullStr = "hello\x00world";
Console.WriteLine($"Null-str length: {nullStr.Length}");
// Deeply nested generics
var deep = new Dictionary<int, Dictionary<int, Dictionary<int, Dictionary<int, Dictionary<int, string>>>>>
{
{ 1, new Dictionary<int, Dictionary<int, Dictionary<int, Dictionary<int, string>>>>
{
{ 2, new Dictionary<int, Dictionary<int, Dictionary<int, string>>>
{
{ 3, new Dictionary<int, Dictionary<int, string>>
{
{ 4, new Dictionary<int, string> { { 5, "deep" } } }
}
}
}
}
}
}
};
Console.WriteLine(deep[1][2][3][4][5]);
// Very long string
string longStr = new string('x', 10000);
Console.WriteLine($"Long string length: {longStr.Length}");
// BOM prefix
byte[] bom = { 0xEF, 0xBB, 0xBF, (byte)'H', (byte)'i' };
Console.WriteLine(Encoding.UTF8.GetString(bom));
// Deep exception nesting
try
{
try
{
try
{
throw new InvalidOperationException("inner");
}
catch (Exception ex)
{
throw new ApplicationException("middle", ex);
}
}
catch (Exception ex)
{
throw new Exception("outer", ex);
}
}
catch (Exception ex)
{
Console.WriteLine($"Nested exception: {ex.Message}");
}
}
}