I am trying to perform some serialization / deserialization operations with a custom exception type. This type has a field defined as:
private object[] resourceMessageParams;
I have nice and strongly typed code with some Linq expression magic, but I want to go even further and do something like this:
using ResourceMessageParamsType = object[];
Instead of this:
(object[])serializationInfo.GetValue( ReflectionHelper.GetPropertyNameFromExpression(() => resourceMessageParams), typeof(object[]));
To accommodate a possible change in the type of this field in the future, you need to change the type only once in the alias definition. However, the compiler stops at object
in using ResourceMessageType = object[];
stating that an identifier is expected. Going to Object[]
helps a little, but this time the bracket is highlighted with the same error message.
Is there a way to define an alias for an array type in C #?
source share