摘要: 格式化是将一个对象转化为字符串,解析则是将字符串转为对象。 在.netFramework中提供了一系列机制来处理这些操作。 1.ToString和Parse:这两个方法是很多类型默认具有的功能 2.格式提供器:对象上其他的ToString(以及Parse)重载方法会接受格式字符串或格式提供器。格式提 阅读全文
posted @ 2020-04-11 15:28 飞天猪皮怪 阅读(1140) 评论(0) 推荐(0) 编辑
摘要: 将数字转化为单词 public class WordFormatProvider : IFormatProvider, ICustomFormatter { static readonly string[] _numberWords= new string[] { "zero","one","two 阅读全文
posted @ 2020-04-11 15:27 飞天猪皮怪 阅读(285) 评论(0) 推荐(0) 编辑