SlideShare ist ein Scribd-Unternehmen logo
1 von 6
Downloaden Sie, um offline zu lesen
Language INtegrated Query
(LINQ)
Eng. Mahmoud Ouf
Lecture 1
mmouf@2017
C# 3.0 Enhancement for LINQ
• Implicitly Typed Local Variables and Arrays
• Object Initializers
• Auto Implemented Properties
• Collection Initializers
• Extension Methods
• Anonymous Types
mmouf@2017
Example
A Common Code developer wants to create a generic method for filtering an
array of integers, but with the ability to specify the algorithm for filtration to
the Application developer
mmouf@2017
Solution
• Solution
public delegate bool IntFilter(int i);
public class Common
{
public static int[] FilterArray(int[] ints, IntFilter filter)
{
ArrayList aList = new ArrayList();
foreach(int I in ints)
{
if(filter(i))
{aList.Add(i);}
}
return((int[])aList.ToArray(typeof(int)));
}
} mmouf@2017
The Application Code Developer (I)
Class MyApplication
{
public static bool IsOdd(int i)
{
return ((i % 2)==1);
}
public static void Main()
{
int[] nums = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int[] fnum = Common.FilterArray(nums, MyApplication.IsOdd);
foreach(int i in fnum)
Console.WriteLine(i);
}
}
mmouf@2017
The Application Code Developer Anonymous
method “C#2.0” (II)
Class MyApplication
{
public static void Main()
{
int[] nums = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int[] fnum = Common.FilterArray(nums, delegate(int i)
{return((i%2)==1);});
foreach(int i in fnum)
Console.WriteLine(i);
}
}
mmouf@2017

Weitere ähnliche Inhalte

Was ist angesagt?

C++ Templates_ Program to Swap Two Numbers Using Function Template - The Craz...
C++ Templates_ Program to Swap Two Numbers Using Function Template - The Craz...C++ Templates_ Program to Swap Two Numbers Using Function Template - The Craz...
C++ Templates_ Program to Swap Two Numbers Using Function Template - The Craz...
Rishikesh Agrawani
 
Language Integrated Query - LINQ
Language Integrated Query - LINQLanguage Integrated Query - LINQ
Language Integrated Query - LINQ
Doncho Minkov
 

Was ist angesagt? (20)

Understanding linq
Understanding linqUnderstanding linq
Understanding linq
 
Module 3: Introduction to LINQ (PowerPoint Slides)
Module 3: Introduction to LINQ (PowerPoint Slides)Module 3: Introduction to LINQ (PowerPoint Slides)
Module 3: Introduction to LINQ (PowerPoint Slides)
 
Intake 38 6
Intake 38 6Intake 38 6
Intake 38 6
 
Intake 38_1
Intake 38_1Intake 38_1
Intake 38_1
 
Intake 38 2
Intake 38 2Intake 38 2
Intake 38 2
 
Template C++ OOP
Template C++ OOPTemplate C++ OOP
Template C++ OOP
 
Intake 38 12
Intake 38 12Intake 38 12
Intake 38 12
 
Intake 37 ef1
Intake 37 ef1Intake 37 ef1
Intake 37 ef1
 
Introduction to C++
Introduction to C++Introduction to C++
Introduction to C++
 
C++ Returning Objects
C++ Returning ObjectsC++ Returning Objects
C++ Returning Objects
 
C++ Templates_ Program to Swap Two Numbers Using Function Template - The Craz...
C++ Templates_ Program to Swap Two Numbers Using Function Template - The Craz...C++ Templates_ Program to Swap Two Numbers Using Function Template - The Craz...
C++ Templates_ Program to Swap Two Numbers Using Function Template - The Craz...
 
Intake 38 3
Intake 38 3Intake 38 3
Intake 38 3
 
Templates
TemplatesTemplates
Templates
 
Language Integrated Query - LINQ
Language Integrated Query - LINQLanguage Integrated Query - LINQ
Language Integrated Query - LINQ
 
Templates
TemplatesTemplates
Templates
 
Intake 38 4
Intake 38 4Intake 38 4
Intake 38 4
 
C++ questions And Answer
C++ questions And AnswerC++ questions And Answer
C++ questions And Answer
 
Templates in c++
Templates in c++Templates in c++
Templates in c++
 
Linq
LinqLinq
Linq
 
CBSE Question Paper Computer Science with C++ 2011
CBSE Question Paper Computer Science with C++ 2011CBSE Question Paper Computer Science with C++ 2011
CBSE Question Paper Computer Science with C++ 2011
 

Andere mochten auch

2013_YOS Strategic Sustainability Plan progress_report
2013_YOS Strategic Sustainability Plan progress_report2013_YOS Strategic Sustainability Plan progress_report
2013_YOS Strategic Sustainability Plan progress_report
Joy Sun
 

Andere mochten auch (10)

2013_YOS Strategic Sustainability Plan progress_report
2013_YOS Strategic Sustainability Plan progress_report2013_YOS Strategic Sustainability Plan progress_report
2013_YOS Strategic Sustainability Plan progress_report
 
ekonomi spasial
ekonomi spasialekonomi spasial
ekonomi spasial
 
Frederic Laloux Reinventing Organizations
Frederic Laloux Reinventing OrganizationsFrederic Laloux Reinventing Organizations
Frederic Laloux Reinventing Organizations
 
presentation reinventing organizations english frederic laloux
presentation reinventing organizations english frederic lalouxpresentation reinventing organizations english frederic laloux
presentation reinventing organizations english frederic laloux
 
A Missionary Detour: Heaven by Way of the Big Island
A Missionary Detour: Heaven by Way of the Big IslandA Missionary Detour: Heaven by Way of the Big Island
A Missionary Detour: Heaven by Way of the Big Island
 
Juguetenosexista t
Juguetenosexista tJuguetenosexista t
Juguetenosexista t
 
The Product Owner's Survival Kit - ein Überblick [DE]
The Product Owner's Survival Kit - ein Überblick [DE]The Product Owner's Survival Kit - ein Überblick [DE]
The Product Owner's Survival Kit - ein Überblick [DE]
 
Research methodology
Research methodologyResearch methodology
Research methodology
 
GERENCIA DE PROYECTOS DE TECNOLOGÍA
GERENCIA DE PROYECTOS DE TECNOLOGÍAGERENCIA DE PROYECTOS DE TECNOLOGÍA
GERENCIA DE PROYECTOS DE TECNOLOGÍA
 
Eqe 17 qualite_td_bin_2015_vdef
Eqe 17 qualite_td_bin_2015_vdefEqe 17 qualite_td_bin_2015_vdef
Eqe 17 qualite_td_bin_2015_vdef
 

Ähnlich wie Intake 37 linq1

Introduction to phyton , important topic
Introduction to phyton , important topicIntroduction to phyton , important topic
Introduction to phyton , important topic
akpgenious67
 
Cvpr2010 open source vision software, intro and training part-iii introduct...
Cvpr2010 open source vision software, intro and training   part-iii introduct...Cvpr2010 open source vision software, intro and training   part-iii introduct...
Cvpr2010 open source vision software, intro and training part-iii introduct...
zukun
 
Function class in c++
Function class in c++Function class in c++
Function class in c++
Kumar
 

Ähnlich wie Intake 37 linq1 (20)

What's new in c# 8.0
What's new in c# 8.0What's new in c# 8.0
What's new in c# 8.0
 
Introduction to phyton , important topic
Introduction to phyton , important topicIntroduction to phyton , important topic
Introduction to phyton , important topic
 
Part - 2 Cpp programming Solved MCQ
Part - 2  Cpp programming Solved MCQ Part - 2  Cpp programming Solved MCQ
Part - 2 Cpp programming Solved MCQ
 
Presentation1 (1).pptx
Presentation1 (1).pptxPresentation1 (1).pptx
Presentation1 (1).pptx
 
Introduction to Python.Net
Introduction to Python.NetIntroduction to Python.Net
Introduction to Python.Net
 
Constructor in c++
Constructor in c++Constructor in c++
Constructor in c++
 
Getting started with C++
Getting started with C++Getting started with C++
Getting started with C++
 
Getting Started with C++
Getting Started with C++Getting Started with C++
Getting Started with C++
 
ObliVM
ObliVMObliVM
ObliVM
 
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptx
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptxStatic abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptx
Static abstract members nelle interfacce di C# 11 e dintorni di .NET 7.pptx
 
Evolution of Patterns
Evolution of PatternsEvolution of Patterns
Evolution of Patterns
 
Designing Architecture-aware Library using Boost.Proto
Designing Architecture-aware Library using Boost.ProtoDesigning Architecture-aware Library using Boost.Proto
Designing Architecture-aware Library using Boost.Proto
 
Interview-level-QA-on-Python-Programming.pdf
Interview-level-QA-on-Python-Programming.pdfInterview-level-QA-on-Python-Programming.pdf
Interview-level-QA-on-Python-Programming.pdf
 
Automation Testing theory notes.pptx
Automation Testing theory notes.pptxAutomation Testing theory notes.pptx
Automation Testing theory notes.pptx
 
Cvpr2010 open source vision software, intro and training part-iii introduct...
Cvpr2010 open source vision software, intro and training   part-iii introduct...Cvpr2010 open source vision software, intro and training   part-iii introduct...
Cvpr2010 open source vision software, intro and training part-iii introduct...
 
C# 8 in Libraries and Applications
C# 8 in Libraries and ApplicationsC# 8 in Libraries and Applications
C# 8 in Libraries and Applications
 
Python
PythonPython
Python
 
Python 3 Programming Language
Python 3 Programming LanguagePython 3 Programming Language
Python 3 Programming Language
 
Function class in c++
Function class in c++Function class in c++
Function class in c++
 
Defaultification Refactoring: A Tool for Automatically Converting Java Method...
Defaultification Refactoring: A Tool for Automatically Converting Java Method...Defaultification Refactoring: A Tool for Automatically Converting Java Method...
Defaultification Refactoring: A Tool for Automatically Converting Java Method...
 

Mehr von Mahmoud Ouf (19)

Relation between classes in arabic
Relation between classes in arabicRelation between classes in arabic
Relation between classes in arabic
 
Intake 38 data access 5
Intake 38 data access 5Intake 38 data access 5
Intake 38 data access 5
 
Intake 38 data access 4
Intake 38 data access 4Intake 38 data access 4
Intake 38 data access 4
 
Intake 38 data access 1
Intake 38 data access 1Intake 38 data access 1
Intake 38 data access 1
 
Intake 38 11
Intake 38 11Intake 38 11
Intake 38 11
 
Intake 38 10
Intake 38 10Intake 38 10
Intake 38 10
 
Intake 38 9
Intake 38 9Intake 38 9
Intake 38 9
 
Intake 38 8
Intake 38 8Intake 38 8
Intake 38 8
 
Intake 38 7
Intake 38 7Intake 38 7
Intake 38 7
 
Intake 38 5 1
Intake 38 5 1Intake 38 5 1
Intake 38 5 1
 
Intake 38 5
Intake 38 5Intake 38 5
Intake 38 5
 
Intake 37 DM
Intake 37 DMIntake 37 DM
Intake 37 DM
 
Intake 37 12
Intake 37 12Intake 37 12
Intake 37 12
 
Intake 37 11
Intake 37 11Intake 37 11
Intake 37 11
 
Intake 37 10
Intake 37 10Intake 37 10
Intake 37 10
 
Intake 37 9
Intake 37 9Intake 37 9
Intake 37 9
 
Intake 37 8
Intake 37 8Intake 37 8
Intake 37 8
 
Intake 37 6
Intake 37 6Intake 37 6
Intake 37 6
 
Intake 37 5
Intake 37 5Intake 37 5
Intake 37 5
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

Intake 37 linq1

  • 1. Language INtegrated Query (LINQ) Eng. Mahmoud Ouf Lecture 1 mmouf@2017
  • 2. C# 3.0 Enhancement for LINQ • Implicitly Typed Local Variables and Arrays • Object Initializers • Auto Implemented Properties • Collection Initializers • Extension Methods • Anonymous Types mmouf@2017
  • 3. Example A Common Code developer wants to create a generic method for filtering an array of integers, but with the ability to specify the algorithm for filtration to the Application developer mmouf@2017
  • 4. Solution • Solution public delegate bool IntFilter(int i); public class Common { public static int[] FilterArray(int[] ints, IntFilter filter) { ArrayList aList = new ArrayList(); foreach(int I in ints) { if(filter(i)) {aList.Add(i);} } return((int[])aList.ToArray(typeof(int))); } } mmouf@2017
  • 5. The Application Code Developer (I) Class MyApplication { public static bool IsOdd(int i) { return ((i % 2)==1); } public static void Main() { int[] nums = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int[] fnum = Common.FilterArray(nums, MyApplication.IsOdd); foreach(int i in fnum) Console.WriteLine(i); } } mmouf@2017
  • 6. The Application Code Developer Anonymous method “C#2.0” (II) Class MyApplication { public static void Main() { int[] nums = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int[] fnum = Common.FilterArray(nums, delegate(int i) {return((i%2)==1);}); foreach(int i in fnum) Console.WriteLine(i); } } mmouf@2017