Visual Studio 2012 and C# 5.0: Upcoming session

Saturday, June 2, 2012

I’m going to give a session at Microsoft offices in Ra’anana (Israel), on the 18th of this month, showing new features in Visual Studio 2012 (RC released a few days ago) and the new features of C# 5.0 (there are two. If you think about async/await – that’s one). The event is free, but you should register at https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032514296&Culture=he-IL See you there!

WPF 4.5 Cookbook

Thursday, April 26, 2012

A few months back, I was approached by Packt publishing, asking me to write a WPF book, in their “cookbook” style, and I accepted. I haven’t written an entire book before, but I have written dozen of courses for Hi-Tech College, John Bryce Training and now for CodeValue, in a range of topics, from Windows Internals and device driver development, to advanced C++, to basic and advanced .NET topics, to WPF, and even some oddities such as the Windows Media Foundation. Writing a book, however, is different than writing a course, and I was at least curious whether I...

WPF 4.5: Markup Extension for Events

Saturday, April 7, 2012

One of the new features coming in WPF 4.5 (already available through the Visual Studio 11 Beta and .NET 4.5 Beta) is the ability to create markup extensions that work on events (as opposed to properties, which have always had this capability). Markup extensions for properties are crucial, and there are quite a few useful ones, such as {Binding} and {StaticResource}. Would this ability be useful for events? One such case is when a command is needed to be invoked (ICommand) because of some event, typically found in MVVM scenarios. The problem is that only some events can actually...
tags: , , , , ,
no comments

What’s New in CLR 4.5 Debugging API?

Tuesday, April 3, 2012

The most used command in the SOS extension DLL is probably !dumpheap. This command is able to show every object on the managed heap. This capability has no match within Visual Studio. The reason is that Visual Studio uses the CLR debugging API, that doesn’t seem to have this capability. At first glance, the ICorDebugProcess interface has the perfect method: EnumerateObjects. What could be better than that? Unfortunately, the documentation states that this method is not implemented… bummer. A while back I created a project CLR Explorer. This was supposed to be a tool to look at managed processes....

Asynchronous Programming with C# 5.0 & .NET 4.5 Session

Monday, March 26, 2012

This morning I gave a session on asynchronous programming with C# 5.0 at Microsoft offices in Ra’anana. Thank you all for attending, it was great fun! As promised, the presentation slides and demos are attached below (the Windows 8 demos can naturally be run on Windows 8 only). The session was recorded, so if you missed it, or just want to hear the same jokes again, the recording will be available in a few days – check out the MSDN blog for details of availability. Async Demos Async Metro Demo Presentation Slides

INotifyPropertyChanged implementation with C# 5.0

Tuesday, March 20, 2012

The INotifyPropertyChanged interface has become a very popular interface, typically used in MVVM scenarios (WPF/Silverlight). It looks simple, with a single member, which is an event, and its basic implementation by some data type may be something like this: class Book : INotifyPropertyChanged {     public event PropertyChangedEventHandler PropertyChanged;       protected virtual void OnPropertyChanged(string propName) {         var pc = PropertyChanged;         if(pc != null)             pc(this, new PropertyChangedEventArgs(propName));     }       string _name;     int _published;       public int Published {         get { return _published; }         set {             if(_published != value) {                 _published = value;                 OnPropertyChanged("Published");             }         }     }  ...
6 comments

What happened to asynchrony with WebClient in .NET 4.5?

Saturday, March 17, 2012

In the Visual Studio 2010 Async CTP, a bunch of extension methods have been added to the WebClient class, to facilitate the “awaiting” of C# 5.0, such as DownloadStringTaskAsync, which can be simply used like so: var wc = new WebClient(); string result = await wc.DownloadStringTaskAsync("http://msdn.microsoft.com"); One of the overloads present in the CTP accepts a CancellationToken, so that the operation could be cancelled by an external CancellationTokenSource. For example: async Task<string> GetData(string uri, CancellationToken token) {     var wc = new WebClient();     string result = await wc.DownloadStringTaskAsync(new...
no comments

Presentations I’ll be giving this month

Tuesday, March 13, 2012

This month turned out to be a busy one for me, at least as far as public presentations are concerned. All sessions are free of charge, but you should register – details follow: Parallel and Asynchronous Programming with .NET 4/4.5 and C# 5.0 This session is to be held on the 20th, at John Bryce offices in Tel Aviv. I will do a quick recap of tasks and the Parallel class, and then move to async programming with and without the new C# 5.0 features. I will be using VS 2010 and the recently released (beta) Visual Studio 11. Link to registration Async...