This is a mirror of official site: http://jasper-net.blogspot.com/

CLR Supported Custom Attributes

| Sunday, March 11, 2012
After working with the CLR for more than a decade, once in a while I still run into surprising behavior.

It turns out that the (non pseudo-) custom attributes that CLR recognizes are only matched by name, not assembly.

So you can do this for example:

using System;
using System.Threading;

namespace System {
  class ThreadStaticAttribute : global::System.Attribute { }
}

class Program {
  [System.ThreadStaticAttribute]
  static int foo;

  public static void Main() {
    WriteFoo();
    foo = 42;

Read more: IKVM.NET Weblog
QR: Inline image 1

Posted via email from Jasper-net

0 comments: