问题描述
CarrierViewModel是viewmodel,即get {} set {}
IEnumerable< carrierviewmodel>费用= null;
费用= getdata.detail()
收费我收到数据。
我有10个属性
我有1个属性City数据类型为字符串我得到的数据为'BLR KA'
这里我只想获得BLR
如何获得那..
我会得到数据清单..
任何建议
我是什么尝试过:
List< string> servicelane = carriersandCharges.Select(e => e.ServiceLane)。ToList();
CarrierViewModel is viewmodel i.e get{} set{}
IEnumerable<carrierviewmodel> Charges = null;
charges=getdata.detail()
In charges i'm getting data.
I have a 10 property
I have 1 property City datatype as string i'm getting data as 'BLR KA'
here i want to get only BLR
how to get that..
I ll get list of data..
Any suggestion
What I have tried:
List<string> servicelane = carriersandCharges.Select(e => e.ServiceLane).ToList();
推荐答案
string[] parts = City.Split(' ');
parts [0]
将为BLR, parts [1]
将是KR
parts[0]
will be "BLR", parts[1]
will be "KR"
这篇关于如何拆分属性中的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!