Code, rants and ramblings of a programmer.
Browse by Tags
Tagged Content List
Using lambdas to create generic factories
One item I find to be limiting in C# is the new generic constraint. The syntax construct specifies that the type backing a given generic parameter contains a parameter less constructor. It allows methods to create instances of generic parameters in a type safe manner. public static...
4 Jun 2010
Why is LINQ absent from debugger windows?
As the owner of the VB.Net portion of the overall debugging experience, I frequently hear the request from customers to add LINQ support into the Watch / Immediate and Locals window. Virtually every other type of expression is available in the debugger windows so why leave one of the most popular ones...
26 Aug 2009
PowerShell LINQ: Take-Count and Take-While
The Take pair of functions are very similar to the Skip functions . The Take expression does essentially the opposite of the Skip functions. Skip is useful for getting elements further down the pipeline. Take is used for getting elements from the start of the pipeline. #=====...
16 Jan 2009
PowerShell LINQ: Skip-While
Next up in the PowerShell LINQ series is SkipWhile . This LINQ function takes an enumerable instance and a predicate. The function will skip the elements in the enumerable while the predicate is true. The argument to the predicate is the current value of the enumerable. The LINQ...
14 Jan 2009
Script Blocks and Closures (or lack there of)
Script blocks are a concise way of representing an expression or statement group in Powershell. It’s the C#/F#/VB lambda equivalent for PowerShell. One difference between C#/F#/VB lambda expressions and a scriptblock is the lack of lexical closures (otherwise known as variable capturing)...
8 Jan 2009
Script Blocks and Arguments: Figuring it out for myself … again
Script blocks are a powershell construct for storing an expression or group of statements inside an expression. It’s the equivalent of a C#/F#/VB Lamba expression. Recently I needed to use a script block but found I had forgotten how to read passed parameters inside the script block. ...
7 Jan 2009
Switching on Types
One action I find frustrating in C# is where a particular action needs to be taken based off of the type of a particular object. Ideally I would like to solve this with a switch statement but switch statements only support constant expressions in C# so no luck there. Previously I've had to resort to...
16 May 2008
SynchronizationContext and Higher Order Functions
It's often useful to ensure that actions occur on specific threads, in particular event handlers. Take Windows Forms for instance where all operations on a Control must occur on the thread it was created on. Typically this is not a problem since WinForms respond to events such as Click, Move...
24 Feb 2008
C# Lambda Type Inference
One of the limitations of C# type inference is that you cannot use it to infer the type of a lambda expression. For example, the following code will not compile var f = () => 4; Normally this is not too much of an issue because you can just explicitly declare the type of the lambda expression...
14 Dec 2007
Lambda Unexpected Behavior
One item you strive to avoid when you design and implement a feature is unexpected behavior. Unfortunately there is one case we couldn't avoid with Lambda's in VB9. I just ran into the this problem when coding up a handler. I wanted to disable a button when the text of particular TextBox...
19 Nov 2007
Page 1 of 1 (10 items)
© 2015 Microsoft Corporation.
Privacy & Cookies