This project is read-only.

Why using object[] as constructor's parameter?

Sep 2, 2010 at 1:42 PM
Edited Sep 2, 2010 at 1:42 PM

In the class Arcana.Contract.Argument.Is.InAtrribute.cs arcane_master used object[] as constructor's input parameter. Why object[]?

I think using IEnumerable is preferred.


Sep 2, 2010 at 6:06 PM


It is because when the attribute is instantiated, if the argument is of type IEnumerable you can not pass an array, it will be a compile error, and the only thing you can do is to create an array of an attribute's parameter type. This is a limitation of .NET platform. It's got reasons and I have explained in the tutorial. Attributes are instantiated by the compiler before the output assembly is built and then serialized and emitted as metadata to the generated assembly.PostSharp is not a pre-compiler for c#, it just is in the middle of the way, So it can not do that.