C# 3.0 & LINQ 천호민 Visual C# MVP zmeun.tistory.com.

Slides:



Advertisements
Similar presentations
Developer Knowledge Sharing Eric Sun Dec, What programming language did you learn in school and since then? Now, its time to refresh …
Advertisements

The Microsoft Technical Roadshow 2007 Language Enhancements and LINQ Daniel Moth Developer & Platform Group Microsoft Ltd
Language Integrated Query (LINQ) Martin Parry Developer & Platform Group Microsoft Ltd
Extension Methods, Anonymous Types LINQ Query Keywords, Lambda Expressions Svetlin Nakov Telerik Corporation
.NET 3.5 – Mysteries. NetFx Evolution NetFx 1.0 C# 1.0, VB 7.0, VS.NET NetFx 1.1 C# 1.1, VB 7.1, VS 2003 NetFx 2.0 C# 2.0, VB 8.0, VS 2005 NetFx 3.0 C#
C# and LINQ Yuan Yu Microsoft Research Silicon Valley.
© Logica All rights reserved ADO vNext LINQ LINQ to SQL Entity Framework Freek Leemhuis
Chapter 3 Functional Programming. Outline Introduction to functional programming Scheme: an untyped functional programming language.
C#/.NET 5/4/ Ian Cooper
Joshua Clark Consultant Sogeti USA Blog:
ASP.NET 3.5 New Features. 2 Agenda What's New in.NET Framework 3.5? Visual Studio 2008 Enhancements LINQ (Language Integrated Query) New ASP.NET Server.
C# 3.0 & LINQ Raimond Brookman – IT Architect
LinqToSharePoint SandBoxed Solution Shakir Majeed Khan
LINQ: Language-Integrated Queries (To be included in C # 3.0) Technology developed by Anders Hejlsberg & friends at Microsoft (2005) Presented by Tal Cohen.
C# 3.0 Tom Roeder CS fa. Version 3 From PDC 2005 preview compiler available LINQ: language-integrated query High level points: adds native query.
C# 3.0 and LINQ Pavel Yosifovich CTO, Hi-Tech College
C# is a functional programming language Andrew Kennedy Microsoft Research Cambridge.
A tour of new features introducing LINQ. Agenda of LINQ Presentation We have features for every step of the way LINQ Fundamentals Anonymous Functions/Lambda.
LINQ Programming in C# LINQ CSE Prof. Roger Crawfis.
 Introduction  What is LINQ  Syntax  How to Query  Example Program.
Reflection IT LINQ & Entity Framework Fons Sonnemans (Trainer)
LINQ, An IntroLINQ, An Intro Florin−Tudor Cristea, Microsoft Student Partner.
Eric Vogel Software Developer A.J. Boggs & Company.
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics Advanced.NET Programming I 11 th Lecture Pavel Ježek
Putting it all together: LINQ as an Example. The Problem: SQL in Code Programs often connect to database servers. Database servers only “speak” SQL. Programs.
Advanced C#, part IV Niels Hallenberg IT University of Copenhagen (With thanks to Peter Sestoft and Kasper Østerbye) BAAAP – Spring 2009.
Introduction to LINQ Lecture # 19 August Introduction How do you interrogate/manipulate data? What if you could do the work in a type-safe," string-free.
LINQ and C# 3.0 Mads Torgersen Program Manager for the C# Language Microsoft Corporation.
LINQ: It’s Not Your Father’s Data Access Denny Boynton Anheuser-Busch Companies.
The.NET Language Integrated Query Project Anders Hejlsberg TLN306 Technical Fellow Microsoft Corporation.
How to be a C# ninja in 10 easy steps Benjamin Day.
Hoang Anh Viet Hà Nội University of Technology Chapter 1. Introduction to C# Programming.
C# 3.0 and LINQ Pavel Yosifovich CTO, Hi-Tech College
TIVDM2Functional Programming Language Concepts 1 Concepts from Functional Programming Languages Peter Gorm Larsen.
Microsoft TechDayshttp:// Роман Здебский Эксперт по технологиям разработки ПО Microsoft
Lambda Expressions Version 1.0
AUC Technologies LINQ (Language Integrated Query) LINQ Presented By : SHAIKH SHARYAR JAVED Software Engineer (Daedalus Software Inc.) Technology Teacher.
C++ 0x 달려 BOA 요 ~ 아. 꿈. 사 비밀 모임 발표 : 김연기. 발표자 는 뉴규 ? 김연기 아. 꿈. 사 오후반 스터디 그룹 장소 예약 담당 (Pattern Oriented Software Architecture 2) ~ Microsoft Visual.
C#: Future Directions in Language Innovation Anders Hejlsberg TLN307 Technical Fellow Microsoft Corporation.
Applied Linq Putting Linq to work Introducing… Class-A Kennisprovider Microsoft development Training Coaching Alex Thissen Trainer/coach.
LINQ & PLINQ (Parallel) Language Integrated Query.
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics Advanced.NET Programming I 10 th Lecture Pavel Ježek
Inside LINQ to Objects How LINQ to Objects work Inside LINQ1.
Satisfy Your Technical Curiosity C# 3.0 Raj Pai Group Program Manager Microsoft Corporation
Functional Programming IN NON-FUNCTIONAL LANGUAGES.
Joel Pobar Language Geek Microsoft DEV320 Improve on C# % Backwards Compatible Language Integrated Query (LINQ)
IAP C# 2011 Lecture 2: Delegates, Lambdas, LINQ Geza Kovacs.
LINQ Language Integrated Query LINQ1. LINQ: Why and what? Problem Many data sources: Relational databases, XML, in-memory data structures, objects, etc.
Ken Casada Developer Evangelist Microsoft Switzerland
Language Integrated Query Mike Taulty Developer & Platform Group Microsoft Ltd
LINQ and Lambda Expressions Telerik Software Academy LINQ Overview.
Luke Hoban Senior Program Manager Microsoft Session Code: DTL319.
Introduction to Functional Programming Part 1 – The Basic Concepts Winter Young
Introduction to.NET Florin Olariu “Alexandru Ioan Cuza”, University of Iai Department of Computer Science.
Part 1: Overview of LINQ Intro to LINQ Presenter: PhuongNQK.
Jim Fawcett CSE681 – Software Modeling and Analysis Fall 2016
Lambda Expressions Version 1.1
Tech·Ed North America /18/2018 2:05 PM
Jim Fawcett CSE681 – Software Modeling and Analysis Fall 2013
Language Integrated Query: (LINQ) An introduction
Advanced .NET Programming I 6th Lecture
.NET and .NET Core 9. Towards Higher Order Pan Wuming 2017.
Language Integrated Query (LINQ)
Visual Studio “Orcas” & .NET Framework v3.5
LINQ & ADO.NET Entity Framework
Технологии доступа к данным на платформе Microsoft.NET
LINQ - 2 Ravi Kumar C++/C# Team.
Advanced .NET Programming I 7th Lecture
Advanced .NET Programming I 6th Lecture
CS4540 Special Topics in Web Development LINQ to Objects
Presentation transcript:

C# 3.0 & LINQ 천호민 Visual C# MVP zmeun.tistory.com

Agenda Part Ⅰ : C# 3.0 New Features Part Ⅲ : LINQ (Language Integrated Query) Part Ⅱ : Functional Programming

C# 3.0 New Features Var Local Variable Anonymous Type Auto-Implemented Properties Object and Collection Initializer Partial Method Extension Method

Demo: C#3.0 New Features

Functional Programming >> Question… : What is the Functional Programming ? Answer is … Paradigm of the Software Programming Avoid State and Mutable Data So, Contrast with the Imperative Programming Style ( 피하다 ) ( 변하기 쉬운 ) ( 대조되다, 대조하다 )( 명령적인 )

Functional Programming >> The Foundation Notions… Higher-Order Function Higher-Order Function First-Class Function First-Class Function Pure Function Recursion Non-Stric & Lazy Evalution Non-Stric & Lazy Evalution Curry Closure

Functional Programming >> Higher-Order & First-Class Function Higher-Order Function Higher-Order Function First-Class Function First-Class Function Pure Function Recursion Non-Stric & Lazy Evalution Non-Stric & Lazy Evalution Curry Closure - 함수를 파라미터로 전달 받고 - 결과를 함수로 리턴 - 수학적인 컨셉과 컴퓨터 과학 용어의 차이 -Closure, Curry 와 관련

Functional Programming >> Pure Function Higher-Order Function Higher-Order Function First-Class Function First-Class Function Pure Function Recursion Non-Stric & Lazy Evaluation Non-Stric & Lazy Evaluation Curry Closure - 다른 프로그램에 영향을 주지 않는 개념 (Have No Side-Effect) - 같은 결과를 리턴하는 함수 - 참조로 전달된 파라미터 값을 수정하지 않고, - 참조로 전달된 객체의 멤버 값을 수정하지 않고, - 외부 객체, 클래스의 static 멤버 들을 수정하지 않는다.

Functional Programming >> Recursion Higher-Order Function Higher-Order Function First-Class Function First-Class Function Pure Function Recursion Non-Stric & Lazy Evaluation Non-Stric & Lazy Evaluation Curry Closure - 재귀호출이라 부르며 - 자기 자신을 호출한다. - 코드를 단순화 하며 -Higher-Order Function 과 연관

Functional Programming >> Non-Strict & Lazy Evaluation Higher-Order Function Higher-Order Function First-Class Function First-Class Function Pure Function Recursion Non-Strict & Lazy Evaluation Non-Strict & Lazy Evaluation Curry Closure - 엄격하지 않은 평가 ?, 게으른 평가 ? Ex) f(x)=x^2 + x + 1, g(x,y)=x + y Q) f(g(1,4)) A)1:f(g(1,4)) -> f(1+4) -> f(5) -> 5^ = 31 2:f(g(1,4))->g(1+4)^2+g(1,4)+1 ->(1+4)^2+(1+4)+1->5^2+5+1 = 31 - 함수의 파라미터를 식 (Expression) 으로 표현 - 식의 반복 계산으로 Closure, Lazy Evaluation 필요. -Lazy Evaluation 은 연산결과가 필요 할때 까지 계산을 지연시키는 기술

Functional Programming >> Closure Higher-Order Function Higher-Order Function First-Class Function First-Class Function Pure Function Recursion Non-Strict & Lazy Evaluation Non-Strict & Lazy Evaluation Curry Closure - 하나의 함수 내 또 다른 함수가 포함되어 있을때 생성 - 외부 함수의 지역 변수를 내부 함수가 참조 가능 - 숨겨진 상태를 처리. OOP 에서도 사용 가능 - 대게 First-Class Function 에서 사용

Functional Programming >> Curry Higher-Order Function Higher-Order Function First-Class Function First-Class Function Pure Function Recursion Non-Strict & Lazy Evaluation Non-Strict & Lazy Evaluation Curry Closure -Curry? 맛있는 인도 음식 ? No! - 다중 파라미터를 갖는 함수에서 실행 - 연결된 함수의 리스트 - 함수가 가지는 N 개의 파라미터에 값을 모두 전달하지 않을 경우 함수가 리턴. 그 외의 경우 함수의 결과 값 리턴. -Closure, Higher-Order Function 과 연관

Demo: Functional Programming’s Foundation Notions

- End of Session 1 -

LINQ (Language-Integrated Query) LINQ Archetecture Lambda Expression Query Expression & Standard Query Operator Expression Tree Deffered Execution

LINQ Archetecture C# 3.0C# 3.0 Visual Basic 9.0Visual Basic 9.0 OthersOthers.NET Language Integrated Query LINQ to Objects LINQ to DataSets LINQ to SQL LINQ to XML Objects XML Relational

LINQ Lambda Expression - 식과 문을 포함하고 대리자 (delegate) 나 식 트리 (Expression Tree) 형식을 만드는데 사용할 수 있는 익명 함수. - C# 프로그래밍 가이드 - public delegate TResult Func (T arg) Syntax : Lambda Operator, “=>” Operator : ex) Func isEven = n => n%2 == 0; Func opSum = (n, m) => n+m;.... max argument to 5

LINQ Query Expression & Standard Query Operator from id in source { from id in source | join id in source on expr equals expr [ into id ] | let id = expr | where condition | orderby ordering, ordering, … } select expr | group expr by key [ into id query ] from id in source { from id in source | join id in source on expr equals expr [ into id ] | let id = expr | where condition | orderby ordering, ordering, … } select expr | group expr by key [ into id query ] Starts with from Zero or more from, join, let, where, or orderby Ends with select or group by Optional into continuation

LINQ Query Expression & Standard Query Operator from c in customers where c.Region == "WA" select new { c.City, c.Phone }; customers.Where(c => c.Region == "WA").Select(c => new { c.City, c.Phone }); Queries translate to method invocations Where, Join, OrderBy, Select, GroupBy, …

LINQ Expression Tree >> Expression > test = c => c.Region == "WA"; public delegate bool Predicate (T item); ParameterExpression c = Expression.Parameter(typeof(Customer), "c"); Expression expr = Expression.Equal( Expression.Property(c, typeof(Customer).GetProperty(“Region")), Expression.Constant("WA") ); Expression > test = Expression.Lambda >(expr, c);

LINQ Expression Tree >> c => c.Region == "WA"; “c” Expression.Paramete r “c.Region == ‘WA’” Expression.Equal Expression.Property Expression.Constant “c.Region” “’WA’”

Demo: Building LINQ in C#3.0

Simplicity C# 3.0 Feature Map var contacts = from c in customers where c.State == "WA" select new { c.City, c.Phone }; var contacts = from c in customers where c.State == "WA" select new { c.City, c.Phone }; var contacts = customers.Where(c => c.State == "WA").Select(c => new { c.City, c.Phone }); var contacts = customers.Where(c => c.State == "WA").Select(c => new { c.City, c.Phone }); Extension method Anonymous type Lambda expression Query expression Object initializer Local variable type inference Expression tree Automatic properties Partial method

Demo: Building LINQ in C#3.0 Continue…

- End of Session 2 -

Resources MSDN C# 3.0 Overview MSDN.Net Framework MSDN Linq To SQL MSDN Linq Project LINQ in Action Blog WikiPedia

Q&A

Thanks…