Marcin Zajkowski PRO
Umbraco MVP x5, Senior Solution Architect / CTO / Country Manager @novicell • Team Captain @wowschoolpl • #umbraCoffee Co-Host • IT Consultant and Public Speaker.
Umbraco Developer, Trainer and Certified Master @ The Cogworks
Team, Technology & Knowledge Wizard (CKO, CIO) / PedagoGEEK @ WOW School
Me @ udfnd.pl
@zajkowskimarcin
Our Umbraco: http://our.umbraco.org/
Community Slack: http://umbracians.chat/
Slides: https://slides.com/zajkowskimarcin/the-future-of-csharp-with-umbraco/
public class GoldenThough1 : ITweetable {
}
public class GoldenThough2 : ITweetable {
}
install-package System.ValueTuple
(only for .NET Framework < 4.7)
public interface ICanHasDefaultMembers
{
void FireDev();
void FireAllDevs()
{
foreach (var dev in theCogworks)
{
FireDev();
}
}
}
public class MySweetClassWhichIDontWantToModify : ICanHasDefaultMembers
{
public void FireDev()
{
// You know what to do :>
}
}
public interface ICanHasDefaultMembers
{
void FireDev();
void FireAllDevs()
{
foreach (var dev in theCogworks)
{
FireDev();
}
}
}
public class MySweetClassWhichIDontWantToModify : ICanHasDefaultMembers
{
public void FireDev()
{
// You know what to do :>
}
private void FireAllDevs()
{
// My private member
}
}
MySweetClassWhichIDontWantToModify myClass = new MySweetClassWhichIDontWantToModify();
myClass.FireAllDevs(); // Doesn't work because FireAllDevs() is private
ICanHasDefaultMembers myClassOnSteroids = (ICanHasDefaultMembers)myClass;
myClassOnSteroids.FireAllDevs(); // It works!
int i = 0; // I can't be null
int? i = null; // I can be null!
string s;
string? t;
t = null;
int i = t.Length; // Warning
if(t != null) {
int j = t.Length; // No warning - smart compiler!
}
if(!t.IsNullOrWhiteSpace()) {
int l = t.Length; // Warning!
int m = t!.Length; // I'm smarter than compiler, and DAMNIT, I don't have null here for sure! :>
}
string s; // Should never be null
string? s1; // Can be null
s?.Length; // Check this one for null, please!
s!.Length; // Don't check this, I'm smarter than you :)
async Task<bool> ThisIsWellKnownAndUsedTaskAsync(){
return true;
}
await ThisIsWellKnownAndUsedTaskAsync();
// ---------------------------------------------------
IAsyncEnumerable<T> willItBlowOrNotHmmmWeWillSee = ...
foreach await(var bang in willItBlowOrNotHmmmWeWillSee)
{
// Thread is not blocked and item is retrieved
// Move next when data is here!
}
Pull model other than push model in IObservable for example
public class SomeClassWhichNeedsToBeExtended
{
}
public static class SomeClassWhichNeedsToBeExtendedExtensions
{
public static T MethodName<T>(this SomeClassWhichNeedsToBeExtended instance)
{
return default(T);
}
}
What we're doing now...
extension MyClassExtension extends ClassToBeExtended
{
public int AddAnotherHead()
{
this.Heads++; // it call the current instance of MyClassExtension
}
public int Heads()
{
get { ... }
}
}
// --------------------------------------------------------------------
extension SomeComplexExtension extends MyClass : IMyInterface
{
...
}
C# in Depth book by J. Skeet (4th Edition - preorder)
https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-7
https://blog.xamarin.com/getting-started-c-7/
https://www.erikheemskerk.nl/csharp-7-0-improvements/
https://www.erikheemskerk.nl/c-sharp-7-1-polishing-usability/
https://www.erikheemskerk.nl/c-sharp-7-2-and-8-0-uncertainty-awesomeness/
https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-7-1
https://blog.jetbrains.com/dotnet/2017/10/25/c-7-0-7-1-support-resharper-pattern-matching-generics/
https://www.erikheemskerk.nl/c-sharp-7-2-and-8-0-uncertainty-awesomeness
https://channel9.msdn.com/Events/Build/2017/B8104
https://channel9.msdn.com/Blogs/Seth-Juarez/A-Preview-of-C-8-with-Mads-Torgersen (Thanks Mads!
https://rubikscode.net/2017/10/23/c-8-the-shape-of-the-things-to-come/
public class GoldenThough3 : ITweetable {
}
By Marcin Zajkowski
Some developers haven't switched their manners to using the new C# 6 features yet and now we have version 7 and 8 on the map! What’s new in the each version? Should we be scared of the coming changes? Should we refactor current solutions or use the latest features in the next projects? For those and other questions we will answer during this talk..
Umbraco MVP x5, Senior Solution Architect / CTO / Country Manager @novicell • Team Captain @wowschoolpl • #umbraCoffee Co-Host • IT Consultant and Public Speaker.