LinqPad4 Language

LinqPad有languange

C# Expression

在这个里面只能写一句linq语句,不能带结尾的分号

linq:

 from a in Alliance_SpecialCommission_Rules join b in Alliance_SpecialCommission_TicketsResources  on a.SCRuleID equals b.SCRuleID
    select new{
    a.AllianceID,b.ScenicName
    } 

sql:

SELECT [t0].[AllianceID], [t1].[ScenicName]
FROM [Alliance_SpecialCommission_Rules] AS [t0]
INNER JOIN [Alliance_SpecialCommission_TicketsResource] AS [t1] ON [t0].[SCRuleID] = [t1].[SCRuleID]

left join

from a in Alliance_SpecialCommission_Rules join b in Alliance_SpecialCommission_TicketsResources on a.SCRuleID equals b.SCRuleID into joinData
    from c in joinData.DefaultIfEmpty ()
    select new{
      a.SCRuleID ,a.AllianceID,a.BusinessType,c.ScenicName, c.ResourceName
    } 
SELECT [t0].[SCRuleID], [t0].[AllianceID], [t0].[BusinessType], [t1].[ScenicName] AS [ScenicName], [t1].[ResourceName] AS [ResourceName]
FROM [Alliance_SpecialCommission_Rules] AS [t0]
LEFT OUTER JOIN [Alliance_SpecialCommission_TicketsResource] AS [t1] ON [t0].[SCRuleID] = [t1].[SCRuleID]

C# Statement(s)

里面可以有多句linq,也可以对对象进行进行赋值

var words=from word in "The quick brown fox jumps over the lazy dog".Split()
orderby word.Length
select word;
words.Dump();

var sce= from a in Alliance_SpecialCommission_Rules join b in Alliance_SpecialCommission_TicketsResources  on a.SCRuleID equals b.SCRuleID
    select new{
    a.AllianceID,b.ScenicName
    };
    sce.Dump();

C# Program

这个就像在vs里面了,可以有类

void Main()
{
        var classify_list = new List<Alliance_FAQ_Classify>
            {
                new Alliance_FAQ_Classify{ClassifyID =1,ClassifyName ="酒店"},
                new Alliance_FAQ_Classify{ClassifyID =2,ClassifyName ="机票"},
                new Alliance_FAQ_Classify{ClassifyID =3,ClassifyName ="团购"},
                new Alliance_FAQ_Classify{ClassifyID =5,ClassifyName ="旅游"},
                new Alliance_FAQ_Classify{ClassifyID =88,ClassifyName ="Other"}
            };

            classify_list.Dump();
            var info_list = new List<Alliance_FAQ_Info>
            {
                new Alliance_FAQ_Info{FAQID =1,ClassifyID =1},
                new Alliance_FAQ_Info{FAQID =2,ClassifyID =1},
                new Alliance_FAQ_Info{FAQID =3,ClassifyID =1},
                new Alliance_FAQ_Info{FAQID =4,ClassifyID =1},
                new Alliance_FAQ_Info{FAQID =5,ClassifyID =1},
                new Alliance_FAQ_Info{FAQID =6,ClassifyID =1},

                new Alliance_FAQ_Info{FAQID =7,ClassifyID =2},
                new Alliance_FAQ_Info{FAQID =8,ClassifyID =2},
                new Alliance_FAQ_Info{FAQID =9,ClassifyID =2},

                new Alliance_FAQ_Info{FAQID =10,ClassifyID =3},
                new Alliance_FAQ_Info{FAQID =11,ClassifyID =3},
                new Alliance_FAQ_Info{FAQID =12,ClassifyID =3},
                new Alliance_FAQ_Info{FAQID =13,ClassifyID =3},
                new Alliance_FAQ_Info{FAQID =14,ClassifyID =3},
                new Alliance_FAQ_Info{FAQID =15,ClassifyID =3},
                new Alliance_FAQ_Info{FAQID =16,ClassifyID =3},
                new Alliance_FAQ_Info{FAQID =17,ClassifyID =3},
                new Alliance_FAQ_Info{FAQID =18,ClassifyID =3},

                new Alliance_FAQ_Info{FAQID =19,ClassifyID =5},
                new Alliance_FAQ_Info{FAQID =22,ClassifyID =5},
                new Alliance_FAQ_Info{FAQID =19,ClassifyID =6},
                new Alliance_FAQ_Info{FAQID =22,ClassifyID =6},
                new Alliance_FAQ_Info{FAQID =19,ClassifyID =7},
                new Alliance_FAQ_Info{FAQID =22,ClassifyID =7}
            };
            info_list.Dump();

             //left join
            var list = from a in info_list
                       join b in classify_list on a.ClassifyID equals b.ClassifyID into joinData
                       from c in joinData.DefaultIfEmpty()
                       select new
                       {
                           a.FAQID,
                           a.ClassifyID ,
                           Name=c!=null?c.ClassifyName :""
                       };
list.Dump();

            var list2 = from a in classify_list
                        join b in info_list on a.ClassifyID equals b.ClassifyID into joinData
                        from c in joinData.DefaultIfEmpty()
                        select new
                        {
                            a.ClassifyID ,
                            a.ClassifyName ,
                            FAQID=c==null?0:c.FAQID
                        };
                    list2.Dump();    

    var words=from word in "The quick brown fox jumps over the lazy dog".Split()
    orderby word.Length
    select word;
    words.Dump();

    var sce= from a in Alliance_SpecialCommission_Rules join b in Alliance_SpecialCommission_TicketsResources  on a.SCRuleID equals b.SCRuleID
        select new{
        a.AllianceID,b.ScenicName
        };
        sce.Dump();

}
    public class Alliance_FAQ_Info
    {
        public int FAQID { get; set; }

        public int ClassifyID { get; set; }
    }

    public class Alliance_FAQ_Classify
    {
        public int ClassifyID { get; set; }

        public string ClassifyName { get; set; }
    }

LINQPAD4破解版(带智能感应)

http://www.cnblogs.com/qiuwuyu/archive/2011/08/30/2159089.html

http://www.cnblogs.com/li-peng/p/3441729.html

时间: 2024-11-13 08:09:29

LinqPad4 Language的相关文章

【翻译】Android Interface Definition Language (AIDL)

参考地址:https://developer.android.com/guide/components/aidl.html Android Interface Definition Language (AIDL) AIDL (Android Interface Definition Language) is similar to other IDLs you might have worked with. It allows you to define the programming inter

Go语言自述(The Go Programming Language README)

声明:本文为笔者为练习英语所做的翻译练习,原文所属者与笔者没有任何关系,翻译结果不代表原文所属者的观点.笔者不保证翻译的正确性,任何人以任何形式的对本文的引用,都是不负责任和荒谬的行为,造成的后果笔者不予负责. 原文链接所属:golang/go Go is an open source programming language that makes it easy to build simple,reliable, and efficient software. Go是一门开源的编程语言,用它可

Mysql DCL (Date Control Language)

Mysql DCL (Date Control Language) 数据库:mysql> select * from fen; +-------+-------+---------+ | name | china | english | +-------+-------+---------+ | ming | 69 | 99 | | hong | 48 | 33 | | qiang | 77 | 33 | +-------+-------+---------+ 3 rows in set (0.

窝上课不听,how to learn C language easily(1)

C language 学习心得 附:为啥起这么霸气侧漏,招大神们鄙视的标题,正如我在<C language>随笔的介绍中写的,这是一个写个妹纸们看的C language的文章.没错!!写这篇文章的灵感也来自于上周Clanguage课上偶撩到一个连书包都不放下在玩手机的妹子(普通聊天而已,嘘~~~),得知她课后在自学慕课,刚看到数组·····那得有多慢!于是,小子虽不才,但正义感十足,决心写一章超级宇宙无敌简单入门炫酷无敌吊炸天的C language 入门指南. 其实,鄙人大一上受了大神Alex

Visual Format Language

https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/AutolayoutPG/VisualFormatLanguage.html#//apple_ref/doc/uid/TP40010853-CH27-SW1 Visual Format Language This appendix shows how to use the Auto Layout Visual Format Lan

Hypertext Application Language(HAL)

Hypertext Application Language(HAL) HAL,全称为Hypertext Application Language,它是一种简单的数据格式,它能以一种简单.统一的形式,在API中引入超链接特性,使得API的可发现性(discoverable)更强,并具有自描述的特点.使用了HAL的API会更容易地被第三方开源库所调用,并且使用起来也很方便,开发者可以像处理普通JSON数据那样去处理API数据.有关HAL的更多信息,可以参考官方网站:http://stateless

转:从《The C Programming Language》中学到的那些编程风格和设计思想

这儿有一篇写的很好的读后感:http://www.cnblogs.com/xkfz007/articles/2566424.html 读书不是目的,关键在于思考. 很早就在水木上看到有人推荐<The C Programming Language>这本书,一直都没看,开学一个月就专心拜读了一下,并认真做了课后习题.读来收获不少,主要有两点:一是加深了自己对一些基础知识的理 解和感悟:二是从中学到了一些不错的编程风格和设计思想,这些东西虽看起来不起眼但细细嚼来还是很值得学习的.下面就从四个方面做一

UML(Unified Modeling Language)统一建模语言

什么是模型 模型是对现实的简化 模型是提供系统的蓝图,模型可是包括详细计划.也可是是从更高程度考虑系统的总体计划,每个系统可以从不同的方面用不通过的模型来描述.因而每个模型都是在语义上闭合的抽象系统.模型可以是结构性的,强调系统的组织.也可是是行为性的,强调系统的动态方面 举例:售楼中心里面的楼盘蓝图 为什么建模 建模是为了能够更好地理解正在开发的系统 通过建模达到下面的目的1.模型有助于按照实际情况或按照所需的样式对系统进行可视化2.模型能够规约系统的结构或行为3.模型给出了构造系统的模板4.

&lt;script language = &quot;javascript&quot;&gt;, &lt;script type = &quot;text/javascript&quot;&gt;和&lt;script language = &quot;application/javascript&quot;&gt;(转)

application/javascript是服务器端处理js文件的mime类型,text/javascript是浏览器处理js的mime类型,后者兼容性更好(虽然application/javascript才是正确写法,由于现在大家都写错的,导致浏览器厂商对写application/javascript兼容性更好).等以后大家都用HTML5的时候,就不需要写这个了.直接<script></script>就OK了! 另外 <script language = "ja