我有这sealed
堂课,
public sealed class A
{
public string AName {get;set;}
}
有人可以为它编写一个扩展方法,如下所示:
public static class Extensions
{
public static void ExtensionMethodForA (this A a)
{
Console.WriteLine("A's Extension method!");
}
}
问题是,你如何防止这种情况发生?