James Montemagno
James Montemagno

Live, Love, Bike, and Code.

Tags


Twitter


James Montemagno

C#

C# Developers: Stop Calling .Result

I love async/await Task based programming! I talk about it in all my demos, it is in all my libraries, and Frank and I did a whole Merge Conflict podcast episode on it. The problem is that I keep getting bug reports and seeing samples where it is being abused and used completely wrong. I am never a fan of calling a lot of async code in a constructor or in the OnCreate/AppDelegate, but the real issue is when I see stuff like this with .Result: public App() { try { _locator.StartLi…

James MontemagnoJames Montemagno

My Favorite C# 7 Feature: More expression-bodied members

I can’t help myself, I love Expression-Bodied Members from C# 6! Combined with other powerful C# features it took this code: public void OnPropertyChanged(string name) { var changed = PropertyChanged; if(changed == null) return; changed(this, new PropertyChangedEventArgs(name)); } to this: public void OnPropertyChanged(string name)=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); This is amazing! However, in C# 7 things get even better. Take our good old fr…

James MontemagnoJames Montemagno

Getting Started With & Learning C#

In 2006, after years of writing C++ and Java code, while attending UAT an instructor named Phil Miller introduced me to this amazing language called C# and changed my life. It was love at first “Hello World” and I have never looked back. C# is an extremely powerful, mature, and extremely cross-platform programming language that I have been using for decades. The beauty of C# of course is that you get this amazing cross-platform framework called .NET, which gives developers ability to…

James MontemagnoJames Montemagno