Skip to content

Instantly share code, notes, and snippets.

@kg
Created January 10, 2018 03:46
Show Gist options
  • Save kg/c0d3039f782f53ea9355046051bd6164 to your computer and use it in GitHub Desktop.
Save kg/c0d3039f782f53ea9355046051bd6164 to your computer and use it in GitHub Desktop.
using System;
public static class Program
{
public const string UnicodeLowSurrogate = "l\uDC00";
public const string UnicodeHighSurrogate = "h\uD800";
public const string UnicodeReplacementCharacter = "\uFFFD";
public static void Main()
{
Console.WriteLine("Entry");
var types = new [] {
typeof (A),
typeof (B),
typeof (C)
};
Console.WriteLine("Array created");
foreach (var t in types) {
Console.WriteLine("Get attribute of {0}", t);
var a = ((ObsoleteAttribute)t.GetCustomAttributes(true)[0]);
var m = a.Message;
Console.WriteLine("Enumerate characters of {0}", m);
foreach (var ch in m)
Console.Write("{0:X2}", (uint)ch);
Console.WriteLine();
}
Console.WriteLine("Done");
}
}
[Obsolete(Program.UnicodeHighSurrogate)]
public class A {
}
[Obsolete(Program.UnicodeLowSurrogate)]
public class B {
}
[Obsolete(Program.UnicodeLowSurrogate + Program.UnicodeHighSurrogate)]
public class C {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment