0

The Azure SDK for Java has an enum with all of the Azure locations, public and national.

Is there similar functionality available for C#? It would be cleaner than using strings.

aoetalks
  • 1,741
  • 1
  • 13
  • 26

2 Answers2

3

Is there similar functionality available for C#?

Yes, please refer to Microsoft.Azure.Management.ResourceManager.Fluent, we could get source code from github. More details please refer to screenshot.

demo code:

string region = Region.AsiaEast.ToString();

enter image description here

oderibas
  • 1,575
  • 12
  • 20
Tom Sun - MSFT
  • 24,161
  • 3
  • 30
  • 47
0

If you need them as List you can try:

typeof(AzureLocation).GetProperties().Select(p => p.Name).ToList();
Evgeni Lilov
  • 121
  • 1
  • 4