String类型的妙用

String类型的妙用

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

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

例子:

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

posted @ 2012-10-10 14:43  杨斌_济南  阅读(261)  评论(0)    收藏  举报