如何拆分属性中的数据? [英] How to split a data in property?

查看:74
本文介绍了如何拆分属性中的数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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();

推荐答案

尝试:

Try:
string[] parts = City.Split(' ');



parts [0] 将为BLR, parts [1] 将是KR


parts[0] will be "BLR", parts[1] will be "KR"


这篇关于如何拆分属性中的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆