c# - Why does this code compile without error even though the class is marked Obsoleted? -


this visual studio 2008. has static class extensions.

public class dummy {     public readonly int x;      public dummy(int x)     {         this.x = x;     }      public override string tostring()     {         return x.tostring();     } }  [obsolete("do not use", true)] public static class extensions {     public static int squared(this dummy dummy)     {         return dummy.x * dummy.x;     } }  class program {     static void main(string[] args)     {         var d = new dummy(42);         console.writeline(string.format("{0}^2={1}", d, d.squared()));     } } 

that repros in vs2010 well. looks bug. i'll entered in database.

you can work around bug putting attribute on actual method.

thanks report!


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -