I have a .NET 8 application where I read in values from an Azure Keyvault and then bind to configuration:
builder.Configuration.AddAzureKeyVault(new Uri($"https://mykeyvault.vault.azure.net/"),
new DefaultAzureCredential()
);
I then try and bind this configuration:
builder.Services.Configure<Settings>(builder.Configuration)
.AddOptionsWithValidateOnStart<Settings>()
.ValidateDataAnnotations();
In my Settings class, I have a property which is a string array:
public string[] MyArrayProperty { get; set; }
The value in the keyvault is a comma separated list:
"USD,EUR,GBP,CAD,JPY"
When I try and bind this property it is returned as null - I understand that my property is expected a string array and I am passing it a string.
How can I convert this string to an array when the binding process takes place?