Quick Tip: LINQ & Data Binding notifications

Tuesday, June 23, 2009

In Silverlight & WPF we could databind to the LINQ query results: private ObservableCollection<string> someData = new ObservableCollection<string>(); //Somewhere in code someData.Add("Alex"); someData.Add("Alen"); someData.Add("Josh"); someData.Add("Brad"); var res = from data in someData            where data.StartsWith("A")            select data; listbox.ItemsSource = res; ”listbox” is the name of the Listbox on my XAML page. When application will load we will get expected results: But what happens when out collection (reminder: ObservableCollection, which implements INotifyCollectionChanged) changed? someData.Add("Antony"); Nothing! Because we bounded to the LINQ query (predicate), and the query was executed...

Tech-Ed 2008 is over

Tuesday, April 8, 2008

Tech-Ed 2008 Israel is over, and I'd like to thanks Microsoft for making it happen. I'd also like to thanks all, who was on my and Tamir's "show". I hope that all attendees enjoy watching it like we enjoyed making it! Don't forget the survey ;) Also, great thanks to Tamir! Stay tuned on videos of how we put all this session together - hope it will here in day or two.   UPDATE #1: My video already posted here UPDATE #2: Tamir's video already posted here   Enjoy,...

Get Ready for Silverlight 2

Sunday, February 24, 2008

The new version of Silverlight will be announced at MIX08 in about a week! It will be Beta 1 version, and it will bring the things, which was missed by many developers like WPF UI Framework (Binding, Styling, Out-Of-The-Box Controls:  Button, Grid, StackPanel, "Cider" in Visual Studio 2008,  etc.), Networking support (REST, SOAP, RSS, etc.), richer BCL (LINQ, Collections, I/O, Generics, Threading, Globalization, XML, Local Storage, etc.) and much more...   See more about this upcoming release and Silverlight 2 tutorials in ScottGu's Blog Enjoy

How to compile C# 3.0 code dynamically

Thursday, December 20, 2007

One of major features being shipped with Visual Studio 2008 was new version of C# language. When one creates new C# project in Visual Studio 2008 it can choose target framework version, which enables functionality/IntelliSense targeted to selected framework. But how some runtime generated code could be compiled with specific framework target? In .NET v3.5 we got new overload to CSharpCodeProvider class, which takes "providerOptions" argument. This argument type is IDictionary<string, string> which could be used co configure compiler properties. Here is code sample, how to compile some basic runtime generated LINQ query: ...
no comments

Anonymous Delegates vs Lambda Expressions vs Function Calls Performance

Tuesday, December 11, 2007

Recently I've worked on some project, where I needed to investigate performance issue. After some investigation, some profiling I've got suspicion, that some function being called a lot of times (more than 100,000 calls in some very specific and relatively short execution path) in profiled code part. It was to strange to see, how relatively simple function consuming so much CPU time. The function did some relative simple arithmetic calculations, based on 2-3 received as parameters. While trying to solve this, I've created some test project to simulate the situation. Lets assume, we have the following function: ...