• 初学linq第一步


         现在没有总结什么,也没有系统想过,只不过在csdn上面看一个朋友有点问题自己就拿今天学的linq给试了一下,呵呵, 具体linq怎么好我就不多说了,大家都知道,其实我还不知道呀,呵呵,慢慢来吧,今天做了个例子,没有什么不同之处呀,为了记住自己学了所以先在这记下来,今天也是来了郑州第八天吧,算上回家,前几天投的简历,这两天全都打电话了,不过晚了,哥找到工作了,呵呵,下次在合作吧!

      string[] list = { "adobe", "excel", "acer", "query", "async", "xianfen", "apple", "amazon", "player", "best", "wow" };
       
            List<student> students = new List<student>
                {
                 new  student { Name="是男人", Gender="男" },
                 new  student { Name="男人", Gender="男" },
                 new  student { Name="是", Gender="男" },
                 new  student { Name="人色", Gender="男" },
                 new  student { Name="是打开的附件人", Gender="男" },
                 new  student { Name="地方", Gender="男" },
                 new  student { Name="都是人废物", Gender="男" },
                 new  student { Name="出色的额", Gender="男" }

                };
         

            var result = from word in list
                         where word.Contains("a")
                         orderby word ascending
                         select word ;

            var resultName = from studentInfo in students
                             where studentInfo.Name.Contains("男") //("的")
                             orderby studentInfo.Name ascending
                             select studentInfo.Name;

            foreach (var person in result)
            {
                Response.Write( person + "<br>");          
            }

            foreach (var item in resultName)
            {
                Response.Write(item + "<br>");          
            }
           
        
        }

        public class student
        {
            public  string Name;
            public  string Gender;
        }

    这种写法我还真有点不适应呢,呵呵,不过好向好东西看齐呀.

    检索数据非常快,以后会试着用用了! 希望正学着的带上我一块呀,没学的咱们开始学,呵呵.

  • 相关阅读:
    cinder支持nfs快照
    浏览器输入URL到返回页面的全过程
    按需制作最小的本地yum源
    创建可执行bin安装文件
    RPCVersionCapError: Requested message version, 4.17 is incompatible. It needs to be equal in major version and less than or equal in minor version as the specified version cap 4.11.
    惠普IPMI登陆不上
    Linux进程状态——top,ps中看到进程状态D,S,Z的含义
    openstack-neutron基本的网络类型以及分析
    openstack octavia的实现与分析(二)原理,架构与基本流程
    flask上下文流程图
  • 原文地址:https://www.cnblogs.com/yhongl/p/3937939.html
Copyright © 2020-2023  润新知