生活就是点点滴滴

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

  需求:将config中配置好的一个string,赋值给程序中的某个枚举中的字段。


guarantee.guaranteeType 
       
= (GuaranteeGuaranteeType)Enum.Parse(typeof(GuaranteeGuaranteeType), ConfigerFile.GuaranteeType, false);


  将配置的字符串ConfigerFile.GuaranteeType作为参数,找到GuaranteeGuaranteeType中匹配的枚举,并转换为(GuaranteeGuaranteeType)枚举类型。

  

  注:Enum.Parse()第三个参数为是否区分大小写。

posted on 2010-03-08 13:36  生活就是点点滴滴  阅读(277)  评论(0编辑  收藏  举报