所以我已经知道如何获取string,int,decimal,现在我在枚举的这一部分中苦苦挣扎。如何将枚举转换为字符串

**Enum statecode = apsp.Customer.BillingAddress.StateCode.Value;**
Customer = new Customer()
       {
         FirstName = fn,
         LastName = ln,
         BillingAddress = new Address
             {
              StreetAddress1 = street1,
              StreetAddress2 = street2,
              City = city,
              **StateCode = statecode**,
              ZipCode = zipcode
              }
        },


所以我想插入这个值。

Enum statecode = apsp.Customer.BillingAddress.StateCode.Value;


这个枚举

StateCode = statecode,

最佳答案

Enum statecode = apsp.Customer.BillingAddress.StateCode;
Customer = new Customer()
   {
     FirstName = fn,
     LastName = ln,
     BillingAddress = new Address
         {
          StreetAddress1 = street1,
          StreetAddress2 = street2,
          City = city,
          StateCode = (StateCode)statecode,
          ZipCode = zipcode
          }
    },

关于c# - 如何将ENUM值从 View 转换为 Controller 的字符串,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/42790194/

10-08 20:32