zoukankan      html  css  js  c++  java
  • 当实体类属性超多时候 映射给实体类属性赋值(拉姆达+实体类映射)

        {
                                     attributeSumValue=  beforEntity.Sum(e => Convert.ToDecimal( e.GetType().GetProperties().Where(o => o.Name == attributeName).Single().GetValue(e, null)));
                                     var attributeBefName = "C" + attributeName.Substring(1, attributeName.Length - 1);
                                     item.GetType().GetProperties().Where(b => b.Name == attributeBefName).Single().SetValue(item, attributeSumValue, null);
                                        //foreach (T_GL_IncomeStatementDataUpload Entity in   beforEntity)
                                        //{
                                        //    Entity.GetType().GetProperties().Where(o=>o.Name==attributeName).Single().GetValue(Entity,null);
                                        //}

                                    }

  • 相关阅读:
    USDT与omniCore钱包
    C# 事件(第四章)
    委托进阶(第三章)
    委托入门(第二章)
    委托入门(第一章)
    asp.net页面生命周期
    在WEB程序中小心使用"ThreadStatic"
    如何在一个请求中共享数据或对象实例
    .net垃圾回收机制原理
    MVC模式简介
  • 原文地址:https://www.cnblogs.com/520cc/p/3949582.html
Copyright © 2011-2022 走看看