Is it possible to alias array type in c#?

I'm trying to do some serialization / deserialization stuff with a custom exception type. This type has a field defined as:

private object[] resourceMessageParams;

I've got all nice and strongly typed code with some Linq expression magic, but I want to go even further than that and do something like this:

using ResourceMessageParamsType = object[];//<-- "Identifier expected" error here
/*...*/
private ResourceMessageParamsType resourceMessageParams;
/*...*/
this.resourceMessageParams = 
    (ResourceMessageParamsType)serializationInfo.GetValue(
        ReflectionHelper.GetPropertyNameFromExpression(() => 
            resourceMessageParams), typeof(ResourceMessageParamsType));

Instead of this:

(object[])serializationInfo.GetValue(
    ReflectionHelper.GetPropertyNameFromExpression(() => 
        resourceMessageParams), typeof(object[]));

To accomodate for possible change of type of this field in the future, so one will have to change the type only once in alias definition. However, the compiler stops at object in using ResourceMessageType = object[]; complaining that an identifier is expected. Changing to Object[] helps somewhat, but this time the bracket is highlighted with the same error message.

Is there a way to define an alias for array type in c#?

7
задан Stanislav Kniazev 13 April 2011 в 22:21
поделиться