SlideShare a Scribd company logo
1 of 17
Download to read offline
Advanced C#
Initializer
StudentName student2 = new StudentName
{
FirstName = “Foulen",
LastName = “Benfoulen",
};
List<string> lst = new List<string>()
{“etd1“, “etd2“, “etd3“, “etd4“ };
Anonymous Types
var variableTypeAnonyme = new { FirstName = "Flavien", Age = 23};
var variableTypeAnonyme = new { DateOfBirth = new DateTime(1984, 11, 15) };
var variableTypeAnonyme = 12;
var variableTypeAnonyme = "Flavien";
Extension methods
public static class Encodage
{
public static string Crypte(string chaine)
{
return
Convert.ToBase64String(Encoding.Default.GetBytes(chaine));
}
public static string Decrypte(string chaine)
{
return
Encoding.Default.GetString(Convert.FromBase64String(chaine));
}
}
Extension methods
static void Main(string[] args)
{
string chaineNormale = "Bonjour";
string chaineCryptee = Encodage.Crypte(chaineNormale)
Console.WriteLine(chaineCryptee);
chaineNormale = Encodage.Decrypte(chaineCryptee);
Console.WriteLine(chaineNormale);
}
Extension methods 2
public static class Encodage
{
public static string Crypte ( this string chaine)
{
return
Convert.ToBase64String(Encoding.Default.GetBytes(chaine));
}
public static string Decrypte ( this string chaine)
{
return
Encoding.Default.GetString(Convert.FromBase64String(chaine));
}
}
Extension methods 2
Delegate
public class TrieurDeTableau
{
private delegate void DelegateTri(int[] tableau);
private void TriAscendant (int[] tableau)
{
Array.Sort(tableau);
}
private void TriDescendant (int[] tableau)
{
Array.Sort(tableau);
Array.Reverse(tableau);
}
}
public class TrieurDeTableau
{
[…Code supprimé pour plus de clarté…]
public void DemoTri(int[] tableau)
{
DelegateTri tri = TriAscendant;
tri(tableau);
//affichage
tri = TriDescendant;
tri(tableau);
//affichage
}}
Using delegates
static void Main(string[] args)
{
int[] tableau = new int[] { 4, 1,10, 8, 5 };
new TrieurDeTableau().DemoTri(tableau);
}
Lambda Expression
Delegate to lambda
DelegateTri tri = delegate(int[] leTableau)
{
Array.Sort(leTableau);
};
DelegateTri tri = (leTableau) =>
{
Array.Sort(leTableau);
};
Lambda
List<int> list = new List<int>(new int[] { 2, -5, 45, 5 });
var positiveNumbers = list.FindAll((int i) => i > 0);
LINQ
From source
Where condition
Select variable
LINQ
class IntroToLINQ{
static void Main()
{
// The Three Parts of a LINQ Query:
// 1. Data source.
int[] numbers = new int[7] { 0, 1, 2, 3, 4, 5, 6 };
// 2. Query creation.
// numQuery is an IEnumerable<int>
var numQuery =
from num in numbers
where (num % 2) == 0
select num;
// 3. Query execution.
foreach (int num in numQuery)
{
Console.Write("{0,1} ", num);
}}}
int[] numbers = new int[7] { 0, 1, 2, 3, 4, 5, 6 };
var evenNumQuery =
from num in numbers
where (num % 2) == 0
select num;
int evenNumCount = evenNumQuery.Count();
List<int> numQuery2 =
(from num in numbers
where (num % 2) == 0
select num).ToList();
// or like this:
// numQuery3 is still an int[]
var numQuery3 =
(from num in numbers
where (num % 2) == 0
select num).ToArray();

More Related Content

What's hot

Are we ready to Go?
Are we ready to Go?Are we ready to Go?
Are we ready to Go?Adam Dudczak
 
Understanding static analysis php amsterdam 2018
Understanding static analysis   php amsterdam 2018Understanding static analysis   php amsterdam 2018
Understanding static analysis php amsterdam 2018Damien Seguy
 
First Steps. (db4o - Object Oriented Database)
First Steps. (db4o - Object Oriented Database)First Steps. (db4o - Object Oriented Database)
First Steps. (db4o - Object Oriented Database)Wildan Maulana
 
The Ring programming language version 1.5.3 book - Part 32 of 184
The Ring programming language version 1.5.3 book - Part 32 of 184The Ring programming language version 1.5.3 book - Part 32 of 184
The Ring programming language version 1.5.3 book - Part 32 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 18 of 88
The Ring programming language version 1.3 book - Part 18 of 88The Ring programming language version 1.3 book - Part 18 of 88
The Ring programming language version 1.3 book - Part 18 of 88Mahmoud Samir Fayed
 
Programming Java - Lection 07 - Puzzlers - Lavrentyev Fedor
Programming Java - Lection 07 - Puzzlers - Lavrentyev FedorProgramming Java - Lection 07 - Puzzlers - Lavrentyev Fedor
Programming Java - Lection 07 - Puzzlers - Lavrentyev FedorFedor Lavrentyev
 
The Ring programming language version 1.7 book - Part 30 of 196
The Ring programming language version 1.7 book - Part 30 of 196The Ring programming language version 1.7 book - Part 30 of 196
The Ring programming language version 1.7 book - Part 30 of 196Mahmoud Samir Fayed
 
Java Basics
Java BasicsJava Basics
Java BasicsSunil OS
 
F# Eye for the C# guy - Øredev 2013
F# Eye for the C# guy - Øredev 2013F# Eye for the C# guy - Øredev 2013
F# Eye for the C# guy - Øredev 2013Phillip Trelford
 
The Ring programming language version 1.10 book - Part 35 of 212
The Ring programming language version 1.10 book - Part 35 of 212The Ring programming language version 1.10 book - Part 35 of 212
The Ring programming language version 1.10 book - Part 35 of 212Mahmoud Samir Fayed
 

What's hot (20)

Java Week4(C) Notepad
Java Week4(C)   NotepadJava Week4(C)   Notepad
Java Week4(C) Notepad
 
Are we ready to Go?
Are we ready to Go?Are we ready to Go?
Are we ready to Go?
 
Understanding static analysis php amsterdam 2018
Understanding static analysis   php amsterdam 2018Understanding static analysis   php amsterdam 2018
Understanding static analysis php amsterdam 2018
 
Java VS Python
Java VS PythonJava VS Python
Java VS Python
 
First Steps. (db4o - Object Oriented Database)
First Steps. (db4o - Object Oriented Database)First Steps. (db4o - Object Oriented Database)
First Steps. (db4o - Object Oriented Database)
 
The Ring programming language version 1.5.3 book - Part 32 of 184
The Ring programming language version 1.5.3 book - Part 32 of 184The Ring programming language version 1.5.3 book - Part 32 of 184
The Ring programming language version 1.5.3 book - Part 32 of 184
 
The Ring programming language version 1.3 book - Part 18 of 88
The Ring programming language version 1.3 book - Part 18 of 88The Ring programming language version 1.3 book - Part 18 of 88
The Ring programming language version 1.3 book - Part 18 of 88
 
srgoc
srgocsrgoc
srgoc
 
Programming Java - Lection 07 - Puzzlers - Lavrentyev Fedor
Programming Java - Lection 07 - Puzzlers - Lavrentyev FedorProgramming Java - Lection 07 - Puzzlers - Lavrentyev Fedor
Programming Java - Lection 07 - Puzzlers - Lavrentyev Fedor
 
The Ring programming language version 1.7 book - Part 30 of 196
The Ring programming language version 1.7 book - Part 30 of 196The Ring programming language version 1.7 book - Part 30 of 196
The Ring programming language version 1.7 book - Part 30 of 196
 
Functions in PHP
Functions in PHPFunctions in PHP
Functions in PHP
 
java sockets
 java sockets java sockets
java sockets
 
Day2
Day2Day2
Day2
 
Day3
Day3Day3
Day3
 
Python course Day 1
Python course Day 1Python course Day 1
Python course Day 1
 
Constructor,destructors cpp
Constructor,destructors cppConstructor,destructors cpp
Constructor,destructors cpp
 
Java Basics
Java BasicsJava Basics
Java Basics
 
F# Eye for the C# guy - Øredev 2013
F# Eye for the C# guy - Øredev 2013F# Eye for the C# guy - Øredev 2013
F# Eye for the C# guy - Øredev 2013
 
Anti patterns
Anti patternsAnti patterns
Anti patterns
 
The Ring programming language version 1.10 book - Part 35 of 212
The Ring programming language version 1.10 book - Part 35 of 212The Ring programming language version 1.10 book - Part 35 of 212
The Ring programming language version 1.10 book - Part 35 of 212
 

Viewers also liked

Evolution of c# - by K.Jegan
Evolution of c# - by K.JeganEvolution of c# - by K.Jegan
Evolution of c# - by K.Jegantalenttransform
 
Configuring SSL on NGNINX and less tricky servers
Configuring SSL on NGNINX and less tricky serversConfiguring SSL on NGNINX and less tricky servers
Configuring SSL on NGNINX and less tricky serversAxilis
 
NuGet Must Haves for LINQ
NuGet Must Haves for LINQNuGet Must Haves for LINQ
NuGet Must Haves for LINQAxilis
 
Donetconf2016: The Future of C#
Donetconf2016: The Future of C#Donetconf2016: The Future of C#
Donetconf2016: The Future of C#Jacinto Limjap
 
Python for the C# developer
Python for the C# developerPython for the C# developer
Python for the C# developerMichael Kennedy
 
C# and the Evolution of a Programming Language
C# and the Evolution of a Programming LanguageC# and the Evolution of a Programming Language
C# and the Evolution of a Programming LanguageJacinto Limjap
 
C# 6.0 - DotNetNotts
C# 6.0 - DotNetNottsC# 6.0 - DotNetNotts
C# 6.0 - DotNetNottscitizenmatt
 
C# 7.0 Hacks and Features
C# 7.0 Hacks and FeaturesC# 7.0 Hacks and Features
C# 7.0 Hacks and FeaturesAbhishek Sur
 
Future of .NET - .NET on Non Windows Platforms
Future of .NET - .NET on Non Windows PlatformsFuture of .NET - .NET on Non Windows Platforms
Future of .NET - .NET on Non Windows PlatformsAniruddha Chakrabarti
 
Functional Programming in C# and F#
Functional Programming in C# and F#Functional Programming in C# and F#
Functional Programming in C# and F#Alfonso Garcia-Caro
 
.NET and C# introduction
.NET and C# introduction.NET and C# introduction
.NET and C# introductionPeter Gfader
 
코드의 품질 (Code Quality)
코드의 품질 (Code Quality)코드의 품질 (Code Quality)
코드의 품질 (Code Quality)ChulHui Lee
 
게임 개발에 자주 사용되는 디자인 패턴
게임 개발에 자주 사용되는 디자인 패턴게임 개발에 자주 사용되는 디자인 패턴
게임 개발에 자주 사용되는 디자인 패턴예림 임
 
C# Tutorial
C# Tutorial C# Tutorial
C# Tutorial Jm Ramos
 
C#으로 게임 엔진 만들기(2)
C#으로 게임 엔진 만들기(2)C#으로 게임 엔진 만들기(2)
C#으로 게임 엔진 만들기(2)지환 김
 
C#으로 게임 엔진 만들기(1)
C#으로 게임 엔진 만들기(1)C#으로 게임 엔진 만들기(1)
C#으로 게임 엔진 만들기(1)지환 김
 

Viewers also liked (20)

New features in C# 6
New features in C# 6New features in C# 6
New features in C# 6
 
Evolution of c# - by K.Jegan
Evolution of c# - by K.JeganEvolution of c# - by K.Jegan
Evolution of c# - by K.Jegan
 
Configuring SSL on NGNINX and less tricky servers
Configuring SSL on NGNINX and less tricky serversConfiguring SSL on NGNINX and less tricky servers
Configuring SSL on NGNINX and less tricky servers
 
NuGet Must Haves for LINQ
NuGet Must Haves for LINQNuGet Must Haves for LINQ
NuGet Must Haves for LINQ
 
Donetconf2016: The Future of C#
Donetconf2016: The Future of C#Donetconf2016: The Future of C#
Donetconf2016: The Future of C#
 
Dynamic C#
Dynamic C# Dynamic C#
Dynamic C#
 
Python for the C# developer
Python for the C# developerPython for the C# developer
Python for the C# developer
 
C# and the Evolution of a Programming Language
C# and the Evolution of a Programming LanguageC# and the Evolution of a Programming Language
C# and the Evolution of a Programming Language
 
C# 6.0 - DotNetNotts
C# 6.0 - DotNetNottsC# 6.0 - DotNetNotts
C# 6.0 - DotNetNotts
 
C# 7.0 Hacks and Features
C# 7.0 Hacks and FeaturesC# 7.0 Hacks and Features
C# 7.0 Hacks and Features
 
Functional Programming with C#
Functional Programming with C#Functional Programming with C#
Functional Programming with C#
 
C# 7
C# 7C# 7
C# 7
 
Future of .NET - .NET on Non Windows Platforms
Future of .NET - .NET on Non Windows PlatformsFuture of .NET - .NET on Non Windows Platforms
Future of .NET - .NET on Non Windows Platforms
 
Functional Programming in C# and F#
Functional Programming in C# and F#Functional Programming in C# and F#
Functional Programming in C# and F#
 
.NET and C# introduction
.NET and C# introduction.NET and C# introduction
.NET and C# introduction
 
코드의 품질 (Code Quality)
코드의 품질 (Code Quality)코드의 품질 (Code Quality)
코드의 품질 (Code Quality)
 
게임 개발에 자주 사용되는 디자인 패턴
게임 개발에 자주 사용되는 디자인 패턴게임 개발에 자주 사용되는 디자인 패턴
게임 개발에 자주 사용되는 디자인 패턴
 
C# Tutorial
C# Tutorial C# Tutorial
C# Tutorial
 
C#으로 게임 엔진 만들기(2)
C#으로 게임 엔진 만들기(2)C#으로 게임 엔진 만들기(2)
C#으로 게임 엔진 만들기(2)
 
C#으로 게임 엔진 만들기(1)
C#으로 게임 엔진 만들기(1)C#으로 게임 엔진 만들기(1)
C#으로 게임 엔진 만들기(1)
 

Similar to C# Advanced Initializers, Anonymous Types, Extension Methods, Delegates, Lambda Expressions and LINQ

Generics and Lambda survival guide - DevNexus 2017
Generics and Lambda survival guide - DevNexus 2017Generics and Lambda survival guide - DevNexus 2017
Generics and Lambda survival guide - DevNexus 2017Henri Tremblay
 
Labprogram.javaLinkedList.javaimport java.util.NoSuchElementEx.pdf
Labprogram.javaLinkedList.javaimport java.util.NoSuchElementEx.pdfLabprogram.javaLinkedList.javaimport java.util.NoSuchElementEx.pdf
Labprogram.javaLinkedList.javaimport java.util.NoSuchElementEx.pdffreddysarabia1
 
C# 6.0 - April 2014 preview
C# 6.0 - April 2014 previewC# 6.0 - April 2014 preview
C# 6.0 - April 2014 previewPaulo Morgado
 
Java Foundations: Lists, ArrayList<T>
Java Foundations: Lists, ArrayList<T>Java Foundations: Lists, ArrayList<T>
Java Foundations: Lists, ArrayList<T>Svetlin Nakov
 
CodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodecamp Romania
 
OrderTest.javapublic class OrderTest {       Get an arra.pdf
OrderTest.javapublic class OrderTest {         Get an arra.pdfOrderTest.javapublic class OrderTest {         Get an arra.pdf
OrderTest.javapublic class OrderTest {       Get an arra.pdfakkhan101
 
ARRAYS.ppt
ARRAYS.pptARRAYS.ppt
ARRAYS.pptcoding9
 
Arrays are used to store multiple values in a single variable, instead of dec...
Arrays are used to store multiple values in a single variable, instead of dec...Arrays are used to store multiple values in a single variable, instead of dec...
Arrays are used to store multiple values in a single variable, instead of dec...ssuser6478a8
 
package singlylinkedlist; public class Node { public String valu.pdf
package singlylinkedlist; public class Node { public String valu.pdfpackage singlylinkedlist; public class Node { public String valu.pdf
package singlylinkedlist; public class Node { public String valu.pdfamazing2001
 
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdfLECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdfShashikantSathe3
 

Similar to C# Advanced Initializers, Anonymous Types, Extension Methods, Delegates, Lambda Expressions and LINQ (20)

Generics and Lambda survival guide - DevNexus 2017
Generics and Lambda survival guide - DevNexus 2017Generics and Lambda survival guide - DevNexus 2017
Generics and Lambda survival guide - DevNexus 2017
 
Java programs
Java programsJava programs
Java programs
 
Labprogram.javaLinkedList.javaimport java.util.NoSuchElementEx.pdf
Labprogram.javaLinkedList.javaimport java.util.NoSuchElementEx.pdfLabprogram.javaLinkedList.javaimport java.util.NoSuchElementEx.pdf
Labprogram.javaLinkedList.javaimport java.util.NoSuchElementEx.pdf
 
C# 6.0 - April 2014 preview
C# 6.0 - April 2014 previewC# 6.0 - April 2014 preview
C# 6.0 - April 2014 preview
 
Java Foundations: Lists, ArrayList<T>
Java Foundations: Lists, ArrayList<T>Java Foundations: Lists, ArrayList<T>
Java Foundations: Lists, ArrayList<T>
 
Java Generics
Java GenericsJava Generics
Java Generics
 
6_Array.pptx
6_Array.pptx6_Array.pptx
6_Array.pptx
 
CodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical Groovy
 
OrderTest.javapublic class OrderTest {       Get an arra.pdf
OrderTest.javapublic class OrderTest {         Get an arra.pdfOrderTest.javapublic class OrderTest {         Get an arra.pdf
OrderTest.javapublic class OrderTest {       Get an arra.pdf
 
Chap1 array
Chap1 arrayChap1 array
Chap1 array
 
Fp201 unit4
Fp201 unit4Fp201 unit4
Fp201 unit4
 
ARRAYS.ppt
ARRAYS.pptARRAYS.ppt
ARRAYS.ppt
 
ARRAYS.ppt
ARRAYS.pptARRAYS.ppt
ARRAYS.ppt
 
Arrays are used to store multiple values in a single variable, instead of dec...
Arrays are used to store multiple values in a single variable, instead of dec...Arrays are used to store multiple values in a single variable, instead of dec...
Arrays are used to store multiple values in a single variable, instead of dec...
 
package singlylinkedlist; public class Node { public String valu.pdf
package singlylinkedlist; public class Node { public String valu.pdfpackage singlylinkedlist; public class Node { public String valu.pdf
package singlylinkedlist; public class Node { public String valu.pdf
 
ARRAYS.ppt
ARRAYS.pptARRAYS.ppt
ARRAYS.ppt
 
Java generics
Java genericsJava generics
Java generics
 
C++11 - STL Additions
C++11 - STL AdditionsC++11 - STL Additions
C++11 - STL Additions
 
Linq
LinqLinq
Linq
 
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdfLECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
 

More from Zayen Chagra

Xamarin introduction
Xamarin introductionXamarin introduction
Xamarin introductionZayen Chagra
 
5 one minute Xamarin : MVVM
5 one minute Xamarin : MVVM5 one minute Xamarin : MVVM
5 one minute Xamarin : MVVMZayen Chagra
 
3 one minute Xamarin : Custom ListView
3 one minute Xamarin : Custom ListView 3 one minute Xamarin : Custom ListView
3 one minute Xamarin : Custom ListView Zayen Chagra
 
2 one minute Xamarin: Simple ListView
2 one minute Xamarin: Simple ListView2 one minute Xamarin: Simple ListView
2 one minute Xamarin: Simple ListViewZayen Chagra
 
1 one minute xamarin : UI
1 one minute xamarin : UI1 one minute xamarin : UI
1 one minute xamarin : UIZayen Chagra
 
The very first steps to make my first Mobile App with Xamarin
The very first steps to make my first Mobile App with XamarinThe very first steps to make my first Mobile App with Xamarin
The very first steps to make my first Mobile App with XamarinZayen Chagra
 
Design and User Experience for Windows & Windows Phone
Design and User Experience for Windows & Windows PhoneDesign and User Experience for Windows & Windows Phone
Design and User Experience for Windows & Windows PhoneZayen Chagra
 
Xamarin first mobile application
Xamarin first mobile applicationXamarin first mobile application
Xamarin first mobile applicationZayen Chagra
 
Intel RealSense technology : Overview and demos
Intel RealSense technology : Overview and demosIntel RealSense technology : Overview and demos
Intel RealSense technology : Overview and demosZayen Chagra
 
Dev fest Tunisia 2014: NAO robot and Google technologies
Dev fest Tunisia 2014: NAO robot and Google technologies Dev fest Tunisia 2014: NAO robot and Google technologies
Dev fest Tunisia 2014: NAO robot and Google technologies Zayen Chagra
 
Windows Phone Workshop: WCF services
Windows Phone Workshop: WCF services Windows Phone Workshop: WCF services
Windows Phone Workshop: WCF services Zayen Chagra
 
Windows Phone Workshop: RSS - WCF - JSON - Media Element
Windows Phone Workshop: RSS - WCF - JSON - Media ElementWindows Phone Workshop: RSS - WCF - JSON - Media Element
Windows Phone Workshop: RSS - WCF - JSON - Media ElementZayen Chagra
 
Windows Phone Workshop: Globalization
Windows Phone Workshop: GlobalizationWindows Phone Workshop: Globalization
Windows Phone Workshop: GlobalizationZayen Chagra
 
Windows Phone Workshop: Isolated Storage / LINQ to SQL
Windows Phone Workshop: Isolated Storage / LINQ to SQLWindows Phone Workshop: Isolated Storage / LINQ to SQL
Windows Phone Workshop: Isolated Storage / LINQ to SQLZayen Chagra
 
Windows Phone Workshop: Navigation and parameters
Windows Phone Workshop: Navigation and parameters Windows Phone Workshop: Navigation and parameters
Windows Phone Workshop: Navigation and parameters Zayen Chagra
 
Windows Phone Workshop sensors and battery
Windows Phone Workshop sensors and batteryWindows Phone Workshop sensors and battery
Windows Phone Workshop sensors and batteryZayen Chagra
 
Windows Phone Workshop launchers and choosers
Windows Phone Workshop launchers and choosersWindows Phone Workshop launchers and choosers
Windows Phone Workshop launchers and choosersZayen Chagra
 
Windows 8 seminar presentation
Windows 8 seminar presentationWindows 8 seminar presentation
Windows 8 seminar presentationZayen Chagra
 

More from Zayen Chagra (18)

Xamarin introduction
Xamarin introductionXamarin introduction
Xamarin introduction
 
5 one minute Xamarin : MVVM
5 one minute Xamarin : MVVM5 one minute Xamarin : MVVM
5 one minute Xamarin : MVVM
 
3 one minute Xamarin : Custom ListView
3 one minute Xamarin : Custom ListView 3 one minute Xamarin : Custom ListView
3 one minute Xamarin : Custom ListView
 
2 one minute Xamarin: Simple ListView
2 one minute Xamarin: Simple ListView2 one minute Xamarin: Simple ListView
2 one minute Xamarin: Simple ListView
 
1 one minute xamarin : UI
1 one minute xamarin : UI1 one minute xamarin : UI
1 one minute xamarin : UI
 
The very first steps to make my first Mobile App with Xamarin
The very first steps to make my first Mobile App with XamarinThe very first steps to make my first Mobile App with Xamarin
The very first steps to make my first Mobile App with Xamarin
 
Design and User Experience for Windows & Windows Phone
Design and User Experience for Windows & Windows PhoneDesign and User Experience for Windows & Windows Phone
Design and User Experience for Windows & Windows Phone
 
Xamarin first mobile application
Xamarin first mobile applicationXamarin first mobile application
Xamarin first mobile application
 
Intel RealSense technology : Overview and demos
Intel RealSense technology : Overview and demosIntel RealSense technology : Overview and demos
Intel RealSense technology : Overview and demos
 
Dev fest Tunisia 2014: NAO robot and Google technologies
Dev fest Tunisia 2014: NAO robot and Google technologies Dev fest Tunisia 2014: NAO robot and Google technologies
Dev fest Tunisia 2014: NAO robot and Google technologies
 
Windows Phone Workshop: WCF services
Windows Phone Workshop: WCF services Windows Phone Workshop: WCF services
Windows Phone Workshop: WCF services
 
Windows Phone Workshop: RSS - WCF - JSON - Media Element
Windows Phone Workshop: RSS - WCF - JSON - Media ElementWindows Phone Workshop: RSS - WCF - JSON - Media Element
Windows Phone Workshop: RSS - WCF - JSON - Media Element
 
Windows Phone Workshop: Globalization
Windows Phone Workshop: GlobalizationWindows Phone Workshop: Globalization
Windows Phone Workshop: Globalization
 
Windows Phone Workshop: Isolated Storage / LINQ to SQL
Windows Phone Workshop: Isolated Storage / LINQ to SQLWindows Phone Workshop: Isolated Storage / LINQ to SQL
Windows Phone Workshop: Isolated Storage / LINQ to SQL
 
Windows Phone Workshop: Navigation and parameters
Windows Phone Workshop: Navigation and parameters Windows Phone Workshop: Navigation and parameters
Windows Phone Workshop: Navigation and parameters
 
Windows Phone Workshop sensors and battery
Windows Phone Workshop sensors and batteryWindows Phone Workshop sensors and battery
Windows Phone Workshop sensors and battery
 
Windows Phone Workshop launchers and choosers
Windows Phone Workshop launchers and choosersWindows Phone Workshop launchers and choosers
Windows Phone Workshop launchers and choosers
 
Windows 8 seminar presentation
Windows 8 seminar presentationWindows 8 seminar presentation
Windows 8 seminar presentation
 

Recently uploaded

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
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 RobisonAnna Loughnan Colquhoun
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
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 Scriptwesley chun
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Recently uploaded (20)

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
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
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
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
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

C# Advanced Initializers, Anonymous Types, Extension Methods, Delegates, Lambda Expressions and LINQ

  • 2. Initializer StudentName student2 = new StudentName { FirstName = “Foulen", LastName = “Benfoulen", }; List<string> lst = new List<string>() {“etd1“, “etd2“, “etd3“, “etd4“ };
  • 3. Anonymous Types var variableTypeAnonyme = new { FirstName = "Flavien", Age = 23}; var variableTypeAnonyme = new { DateOfBirth = new DateTime(1984, 11, 15) }; var variableTypeAnonyme = 12; var variableTypeAnonyme = "Flavien";
  • 4. Extension methods public static class Encodage { public static string Crypte(string chaine) { return Convert.ToBase64String(Encoding.Default.GetBytes(chaine)); } public static string Decrypte(string chaine) { return Encoding.Default.GetString(Convert.FromBase64String(chaine)); } }
  • 5. Extension methods static void Main(string[] args) { string chaineNormale = "Bonjour"; string chaineCryptee = Encodage.Crypte(chaineNormale) Console.WriteLine(chaineCryptee); chaineNormale = Encodage.Decrypte(chaineCryptee); Console.WriteLine(chaineNormale); }
  • 6. Extension methods 2 public static class Encodage { public static string Crypte ( this string chaine) { return Convert.ToBase64String(Encoding.Default.GetBytes(chaine)); } public static string Decrypte ( this string chaine) { return Encoding.Default.GetString(Convert.FromBase64String(chaine)); } }
  • 9. public class TrieurDeTableau { private delegate void DelegateTri(int[] tableau); private void TriAscendant (int[] tableau) { Array.Sort(tableau); } private void TriDescendant (int[] tableau) { Array.Sort(tableau); Array.Reverse(tableau); } }
  • 10. public class TrieurDeTableau { […Code supprimé pour plus de clarté…] public void DemoTri(int[] tableau) { DelegateTri tri = TriAscendant; tri(tableau); //affichage tri = TriDescendant; tri(tableau); //affichage }}
  • 11. Using delegates static void Main(string[] args) { int[] tableau = new int[] { 4, 1,10, 8, 5 }; new TrieurDeTableau().DemoTri(tableau); }
  • 13. Delegate to lambda DelegateTri tri = delegate(int[] leTableau) { Array.Sort(leTableau); }; DelegateTri tri = (leTableau) => { Array.Sort(leTableau); };
  • 14. Lambda List<int> list = new List<int>(new int[] { 2, -5, 45, 5 }); var positiveNumbers = list.FindAll((int i) => i > 0); LINQ From source Where condition Select variable
  • 15. LINQ class IntroToLINQ{ static void Main() { // The Three Parts of a LINQ Query: // 1. Data source. int[] numbers = new int[7] { 0, 1, 2, 3, 4, 5, 6 }; // 2. Query creation. // numQuery is an IEnumerable<int> var numQuery = from num in numbers where (num % 2) == 0 select num; // 3. Query execution. foreach (int num in numQuery) { Console.Write("{0,1} ", num); }}}
  • 16. int[] numbers = new int[7] { 0, 1, 2, 3, 4, 5, 6 }; var evenNumQuery = from num in numbers where (num % 2) == 0 select num; int evenNumCount = evenNumQuery.Count();
  • 17. List<int> numQuery2 = (from num in numbers where (num % 2) == 0 select num).ToList(); // or like this: // numQuery3 is still an int[] var numQuery3 = (from num in numbers where (num % 2) == 0 select num).ToArray();