工作笔记:web service中使用linq 动态增减返回字段

本文介绍了一段使用C#编写的代码,该代码通过LINQ查询从资源业务逻辑层加载资源列表,并为每个资源动态添加图标路径。具体包括了如何创建资源列表、加载资源并设置多种属性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

public IEnumerable LoadResourceList(string query, int start, int pageSize)
        {
            string errMsg;
            Dictionary<T_System_DocumentResource, string> resWithIcon = new Dictionary<T_System_DocumentResource, string>();
            List<T_System_DocumentResource> resList = bll.LoadResourceList(query, out errMsg, start, pageSize);


            var aa = from res in resList
                     select new
                     {
                         Icon = FileUtil.GetIcon(res.Extension)//动态添加,javascript可直接调用
                         ,
                         res.ResourceID
                         ,
                         res.ResourceType
                         ,
                         res.Title
                         ,
                         res.Size
                         ,
                         res.PublishDate
                         ,
                         res.Extension
                     };
            return aa;
        }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值