Forwarded from عکس نگار
▪️CSharp 7.0 Hacks and Features
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️String interpolation in a nutshell
public override string ToString() =>
"My Width is {Width} and my Height is {Height}";
public override string ToString()
{
object[] args = new object[] { this.Width, this.Height };
return string.Format("My Width is {0} and my Height is {1}", args);
}
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️String interpolation in a nutshell
public override string ToString() =>
"My Width is {Width} and my Height is {Height}";
public override string ToString()
{
object[] args = new object[] { this.Width, this.Height };
return string.Format("My Width is {0} and my Height is {1}", args);
}
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
Forwarded from عکس نگار
▪️CSharp 7.0 Hacks and Features
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️String interpolation in a nutshell
int age = 28;
var result = "Hello there, I'm {age : D5} years
WriteLine(result);
int num = 28;
object[] objArray1 = new object[] { num };
Console.WriteLine(string.Format("Hello there, I'm {0:D5} years old!", objArray1));
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️String interpolation in a nutshell
int age = 28;
var result = "Hello there, I'm {age : D5} years
WriteLine(result);
int num = 28;
object[] objArray1 = new object[] { num };
Console.WriteLine(string.Format("Hello there, I'm {0:D5} years old!", objArray1));
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
Forwarded from عکس نگار
▪️CSharp 7.0 Hacks and Features
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️nameof operator
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️nameof operator
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
Forwarded from عکس نگار
▪️CSharp 7.0 Hacks and Features
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️nameof operator in a nutshell
static void Main(string[] args)
{
WriteLine("Parameter name is: {nameof(args)}");
}
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️nameof operator in a nutshell
static void Main(string[] args)
{
WriteLine("Parameter name is: {nameof(args)}");
}
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
Forwarded from عکس نگار
▪️CSharp 7.0 Hacks and Features
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️nameof operator in a nutshell
public double CalculateArea(int width, int height)
{
if (width <= 0)
{
throw new ArgumentException("Parameter {nameof(width)} cannot be less than
}
return width * height;
}
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️nameof operator in a nutshell
public double CalculateArea(int width, int height)
{
if (width <= 0)
{
throw new ArgumentException("Parameter {nameof(width)} cannot be less than
}
return width * height;
}
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
Forwarded from عکس نگار
▪️CSharp 7.0 Hacks and Features
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️There’s more?? C#7.0
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️There’s more?? C#7.0
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
Forwarded from عکس نگار
▪️CSharp 7.0 Hacks and Features
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Binary literals and Digit separators
//--like
//0b00001000
//0xFF_00_FA_AF
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Binary literals and Digit separators
//--like
//0b00001000
//0xFF_00_FA_AF
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
Forwarded from عکس نگار
▪️CSharp 7.0 Hacks and Features
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Event initializers
var client = new WebClient
{
DownloadFileCompleted +=
DownloadFileCompletedHandler
};
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Event initializers
var client = new WebClient
{
DownloadFileCompleted +=
DownloadFileCompletedHandler
};
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
Forwarded from عکس نگار
▪️CSharp 7.0 Hacks and Features
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Nested Methods
void MyMethod(){
void calculator(int x)
{
return x * 2;
};
return calculator(10);
}
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Nested Methods
void MyMethod(){
void calculator(int x)
{
return x * 2;
};
return calculator(10);
}
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
Forwarded from عکس نگار
▪️CSharp 7.0 Hacks and Features
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Field targets on auto-properties
[field: NonSerialized]
public int Age { get; set; }
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Field targets on auto-properties
[field: NonSerialized]
public int Age { get; set; }
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
Forwarded from عکس نگار
▪️CSharp 7.0 Hacks and Features
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Inherent use of Tuples and language integration
(int x, int y) MyFunction(){
Console.WriteLine(“My Tuple is called”);
}
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Inherent use of Tuples and language integration
(int x, int y) MyFunction(){
Console.WriteLine(“My Tuple is called”);
}
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
Forwarded from عکس نگار
▪️CSharp 7.0 Hacks and Features
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Inherent use of Tuples and language integration
public class Person
{
public readonly (string firstName, string lastName) Names; // a tuple
public Person((string FirstName, string LastName)) names, int Age)
{
Names = names;
}
}
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Inherent use of Tuples and language integration
public class Person
{
public readonly (string firstName, string lastName) Names; // a tuple
public Person((string FirstName, string LastName)) names, int Age)
{
Names = names;
}
}
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
Forwarded from عکس نگار
▪️CSharp 7.0 Hacks and Features
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Inherent use of Tuples and language integration
(string first, string last) = GetNames("Inigo Montoya")
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Inherent use of Tuples and language integration
(string first, string last) = GetNames("Inigo Montoya")
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
Forwarded from عکس نگار
▪️CSharp 7.0 Hacks and Features
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Using params with IEnumerable
int Avg(params IEnumerable<int> numbers)
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Using params with IEnumerable
int Avg(params IEnumerable<int> numbers)
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
Forwarded from عکس نگار
▪️CSharp 7.0 Hacks and Features
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Declaration Expressions
public void CalculateAgeBasedOn(int birthYear, out int age)
{
age = DateTime.Now.Year - birthYear;
}
CalculateAgeBasedOn(1987, out var age);
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Declaration Expressions
public void CalculateAgeBasedOn(int birthYear, out int age)
{
age = DateTime.Now.Year - birthYear;
}
CalculateAgeBasedOn(1987, out var age);
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
Forwarded from عکس نگار
▪️CSharp 7.0 Hacks and Features
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Primary Constructors
class Person(string name, int age)
{
private string _name = name;
private int _age = age;
}
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Primary Constructors
class Person(string name, int age)
{
private string _name = name;
private int _age = age;
}
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
Forwarded from عکس نگار
▪️CSharp 7.0 Hacks and Features
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Pattern Matching
object obj;
// ...
switch(obj)
{
case 42:
// ...
case Color.Red:
// ...
case string s:
// ...
case Point(int x, 42) where (Y > 42):
// ...
case Point(490, 42): // fine
// ...
default:
// ...
}
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Pattern Matching
object obj;
// ...
switch(obj)
{
case 42:
// ...
case Color.Red:
// ...
case string s:
// ...
case Point(int x, 42) where (Y > 42):
// ...
case Point(490, 42): // fine
// ...
default:
// ...
}
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
Forwarded from عکس نگار
▪️CSharp 7.0 Hacks and Features
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Async Streams
⚪️ IAsyncEnumerable will also work withAwait. It has
MoveNextAsync and Current property like
IEnumerable, and you can call them
using foreach loops.
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Async Streams
⚪️ IAsyncEnumerable will also work withAwait. It has
MoveNextAsync and Current property like
IEnumerable, and you can call them
using foreach loops.
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
Forwarded from عکس نگار
▪️CSharp 7.0 Hacks and Features
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Async Streams
⚪️ Inherently thread-safe
⚪️ Makes it easier to use and reason about code
⚪️ Easier to parallelize your code
⚪️ Reference to immutable objects can be cached, as they won’t
change
public immutable class Point
{
public Point(int x, int y)
{
X = x;
Y = y;
}
public int X { get; }
public int Y { get; }
}
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Async Streams
⚪️ Inherently thread-safe
⚪️ Makes it easier to use and reason about code
⚪️ Easier to parallelize your code
⚪️ Reference to immutable objects can be cached, as they won’t
change
public immutable class Point
{
public Point(int x, int y)
{
X = x;
Y = y;
}
public int X { get; }
public int Y { get; }
}
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
Forwarded from عکس نگار
▪️CSharp 7.0 Hacks and Features
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Summary
⚪️ C# 6.0 is awesome
⚪️ There’s a lot of change in C# 6.0 • .NET Compiler Platform
("Roslyn") makes it easy for Microsoft to improve the language
⚪️ There’s a lot of interesting features that could go in C# 7.0
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages
⏹The presentation talks about latest version of C# with context to next version of it.
⚪️Summary
⚪️ C# 6.0 is awesome
⚪️ There’s a lot of change in C# 6.0 • .NET Compiler Platform
("Roslyn") makes it easy for Microsoft to improve the language
⚪️ There’s a lot of interesting features that could go in C# 7.0
Ref: slideshare.net
#WroteBy <Abhishek Sur>
#Date <30 May 2016>
#ProgrammingLanguage
#Microsoft
#DotNeT
#CSharp
#CSharp7
#SlideShare
#Summary
by @D4NTESPARDA
@ @ProgrammingLanguages