String类型的妙用

String类型的妙用

① 可以把一种数据类型的数据转换成String类型后,可以利用String类特有的方法,进行我们想要的处理,

处理完之后,再转换为另外一种数据类型。

例子:

                                //单价
                                string strPrice = returnItem.Price;
                                if (string.IsNullOrEmpty(strPrice))
                                {
                                    returnItemModel.price = 0M;
                                }
                                else
                                {
                                    returnItemModel.price = Convert.ToDecimal(returnItem.Price);
                                }

原文地址:https://www.cnblogs.com/YangBinChina/p/2718295.html