Pavel's Blog

Pavel is a software guy that is interested in almost everything software related... way too much for too little time

Browse by Tags

All Tags » C# (RSS)
WeakReferences and Events
One of the well-known pitfalls of using events, is the holding of the subscriber instance by the publisher (if connecting to a delegate holding an instance method). If the subscriber forgets to unsubscribe, the instance cannot be garbage collected because the publisher holds a reference to it. Worse yet, the subscriber continues to receive event notifications even though it’s not interested. One way to deal with this is presented in Jeffrey Richter’s book “CLR via C#” . The idea is based on a custom...
Posted: Jan 07 2010, 01:35 PM by pavely | with 2 comment(s)
תגים:, , ,
Upcoming Courses and an Event
I’ll be teaching next week (starting from the 16th) a five day course (split) entitled “The C# 3.0 programming language” on .NET and C# fundamentals. On the 18th of this month, I’ll do an open house at Microsoft on C# 3.0 and LINQ (same thing I did a few months back at Air Force house, so if you were there, no need to come again – unless you really like the food). You can register here . On March 1st, I’ll be teaching my Windows Internals class (for developers) on the (obviously) internals of the...
My Developer Academy 3 Demos
Yesterday, at the Developer Academy 3 , I delivered the talk entitled “Hardcore C#: Power and Flexibility”. I was very happy to find so many people in the talk. Thank you all for coming! I know it’s not easy hearing about iterators so early in the morning! The demos will be published shortly on the Dveloper Academy 3 web site. The demos include more than was in the talk itself, on partial classes and methods, dynamic delegates and expression trees. At the initial stages of planning, I wanted all...
Asynchronous Delegates
Every delegate has the inherent ability to be called asynchronously. When a delegate is defined, the compiler creates a new class inheriting from MultiCastDelegate and synthesizes a constructor and 3 methods: The first, and most well known, is Invoke , that accepts the arguments defined in the delegate signature. This is the method called when the delegate is "invoked". Assuming the following: delegate int BinaryDelegate( int a, int b, out bool overflow); An instance of the delegate can...
What can we expect in C# 4.0?
Actually, I have no idea... but here are my suggestions for new features that I think are worth it: 1. Generic Operators Currently, operators do not work on generic types without some base class constraint that defines those operators. For instance, the following code does not compile: public static T Sum<T>(IEnumerable<T> data) where T : struct { T sum = new T(); foreach (T i in data) sum += i; return sum; } The reason is that the compiler and the CLR cannot insure all types have the...
קורסים קרובים שאני מעביר
שני קורסים שאני עומד להעביר בקרוב ואולי יעניינו מישהו... ב-27 ליולי (החודש הזה) אני מעביר את Advanced .NET with C# - הקורס הורחב ל-4 ימים וכולל גם את .NET security ומבוא ל-C# 3 ו-LINQ. סילבוס מלא ניתן למצוא כאן . ב-31 לאוגוסט אני מעביר את הקורס Windows Internals ששודרג אף הוא וכולל חומר חדש על ה-Internals של Windows Vista ו-Windows Server 2008. הקורס כולל חומר המסביר את אופן הפעולה של Windows ברמת ה-kernel וחלקים הקרובים ל-kernel. הוא מיועד לכל מי שרוצה להבין לעומק כיצד Windows עובד בנושאים כגון...
ReSharper 4.0 beta is available for download
זמין להורדה גירסה 4 בטא של המוצר ReSharper ( www.jetbrains.com ) שהוא Addin חכם ל-Visual Studio 2005 ו-2008 ומטפל בשפות C# ו-VB. גרסה זו תומכת ב-C# 3.0 ו-VB 9.0.אחד המאפיינים הנחמדים שלו היא היכולת להמיר משפט LINQ בפורמט שאילתה לגרסת extension methods . לדוגמא, את השאילתה הבאה var products = from p in ctx.Products where p.Category.CategoryName.StartsWith("B") orderby p.UnitPrice descending select p; הופך בלחיצת כפתור ל- var products = ctx.Products.Where(p => p.Category.CategoryName.StartsWith...
Open House on C# 3.0 and LINQ
טק-אד נגמר... פסח נגמר... חוזרים לשגרה - הרצאות, טכנולוגיות, קורסים... ב-28 למאי אני מעביר "בית פתוח" במייקרוסופט (זה יהיה בבית חיל האויר) בנושא C# 3.0 ו-LINQ. כל מי שעדיין לא יצא לו להכיר את החידושים המגיעים עם Visual Studio 2008 וה-.NET 3.5, מוזמן. לינק לרישום ניתן למצוא כאן .
Posted: May 02 2008, 10:11 AM by pavely | with no comments
תגים:, ,
Upcoming Courses/Events in which I'm in...
The Visual Studio 2008/Windows Server 2008/SQL Server 2008 open day at Hi-Tech College is on the 13th of this month. I'll be doing 2 sessions, one on using LINQ with C# and the other about the ASP.NET MVC framework (hopefully with the update coming at the time of MIX). Check out Hi-tech College's web site for more details. Next, I'm going to give a 3-day course titled "Advanced .NET with C# 2.0" on the 17-19 of this month (course 4151) at Hi-Tech College. This course drills...
.NET, COM and Apartments Tips
We all know that when we use COM interop with .NET we get some RCW (Runtime Callable Wrapper) CLR object representing and controlling access to the underlying COM object. When we call the C# new operator, under the hood the RCW calls the CoCreateInstance API to create the actual COM object, etc. What may not be apparent, is that there may exist another proxy to the COM object, even if the COM server is a DLL (in-process server). The reason this may happen is related to COM apartments. an Apartment...
Spec# - the successor to C#?
An interesting project from Microsoft Research called Spec# ("spec sharp"), is a programming system consisting of a an extension to the C# language that extends the CLR type system with various new features, all designed to enforce safety, hopefully resulting in "high-quality software" (at least this is the aspiration). The downloads include a plugin for VS 2005 that includes the compiler and several samples. Who knows, maybe this is the next great thing?
Posted: Jan 31 2008, 02:51 PM by pavely | with no comments
תגים:, ,