October 21, 2004

C#/CLR Quiz

Recently I have been writing a managed interface to metadata and found several interesting things which I didn't know before. One of these things can be easily demonstrated with C# code, so I decided to make a quiz (just like Brad Abrams does) Consider the following code snipplets:
1)
using System;

class CustomAttribute : Attribute
{
	public CustomAttribute( string s )
	{
	}
}

[Custom(null)]
class C
{
	
}
================================================
2)
using System;

class CustomAttribute : Attribute
{
	public CustomAttribute( object s )
	{
	}
}

[Custom(null)]
class C
{
	
}
=============================================
3)
using System;

class CustomAttribute : Attribute
{
	public CustomAttribute( object[] s )
	{
	}
}

[Custom(null)]
class C
{
	
}
Exactly one of them doesn't comple. Which one is it and why it doesn't compile? Posted by Oleg Stepanov at October 21, 2004 04:07 PM | TrackBack
Comments

Keep on coding!

Posted by: dotnet at November 3, 2004 10:28 PM
Post a comment









Remember personal info?