public Type ToType(IExpressionContext context) { var type = context.ResolveType(this); if (type == null) { if (string.IsNullOrWhiteSpace(Name)) { return(null); } throw new SerializationException($"Failed to serialize '{Name}' to a type object."); } if (GenericArguments != null) { type = type.MakeGenericType(GenericArguments.Select(t => t.ToType(context)).ToArray()); } return(type); }