Web Log di Adrian Florea

"You know you've achieved perfection in design, not when you have nothing more to add, but when you have nothing more to take away." Antoine de Saint-Exupery
posts - 440, comments - 2715, trackbacks - 3944

My Links

Archives

Post Categories

Image Galleries

.RO Blogs

.RO People

.RO Sites

Blogs

Furls

Links

vinCitori

Quiz Sharp #39

using System;

class Bar: Attribute
{
  static Bar()
  {
    Foo.WriteNumberOfCustomAttributes();
  }
  public Bar()
  {
    Console.Write("Bar ");
  }
}

[Bar]
class Foo
{
  public static void WriteNumberOfCustomAttributes()
  {
    Console.Write(typeof(Foo).GetCustomAttributes(false).Length + " ");
  }
  static void Main()
  {
    WriteNumberOfCustomAttributes();
    Console.Read();
  }
}

Cosa viene visualizzato a console?

  • A. 1
  • B. 1 1
  • C. 1 Bar 1
  • D. 1 Bar 1 Bar
  • E. Bar 1 Bar 1

E perché?

Print | posted on domenica 21 novembre 2004 14:26 | Filed Under [ Quiz Sharp ]

Powered by:
Powered By Subtext Powered By ASP.NET