Store String Array In appSettings?

前端 未结 5 1725
借酒劲吻你
借酒劲吻你 2020-11-29 07:57

I\'d like to store a one dimensional string array as an entry in my appSettings. I can\'t simply separate elements with , or | because

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-29 08:55

    For strings it is easy, simply add the following to your web.config file:

    
    

    and then you can retrieve the value into an array as follows:

    var myArray = ConfigurationManager.AppSettings["myStringArray"].Split(',');
    

提交回复
热议问题