Paulo Morgado

.NET Development & Architecture

This Blog

Syndication

Search

Tags

News

Unit Test Today! Get Typemock Isolator!

Projects

Books

 

Visitors

Visitor Locations

Community

Email Notifications

Archives

Profile

Disclaimer

The opinions and viewpoints expressed in this site are mine and do not necessarily reflect those of Microsoft, my employer or any community that I belong to. Any code or opinions are offered as is. Products or services mentioned are purchased by me, made available to me by my employer or the manufacturer/vendor which doesn't influence my opinion in any way.

Browse by Tags

All Tags » C# (RSS)
What’s New In C# 5.0 Session Materials From Rumos InsideOut Event
Here are the materials from my What’s New In C# 5.0 session at the Rumos InsideOut Event . Slide deck: What's New In C# 5.0 from Paulo Morgado Sample code: C# 5.0 Async/Await Demo Code

Posted Sun, Oct 7 2012 21:51 by Paulo Morgado | with no comments

C# 5.0 Async/Await Demo Code
I’ve published the sample code I use to demonstrate the use of async / await in C# 5.0. You can find it here . Projects PauloMorgado.AyncDemo.WebServer This project is a simple web server implemented as a console application using Microsoft ASP.NET Web...

Posted Sun, Oct 7 2012 21:46 by Paulo Morgado | with no comments

Breaking Changes In Argument List Evaluation In C# 5.0
The C# Language Specification states on §7.5.1.2 that “(…) the expressions or variable references of an argument list are evaluated in order, from left to right (…)”. So, when this code is compiled with the C# 4.0 compiler: static void M( int x = 10,...

Posted Wed, Jul 18 2012 1:22 by Paulo Morgado | with no comments

Announcing The Microsoft Roslyn CTP
The Roslyn team has announced general availability of the Roslyn CTP ! The official launch is at http://msdn.com/roslyn , and there were a number of blogs to publicize the availability broadly ( soma , ericli , vsteam , vbteam , c#faq ) and across twitter...

Posted Thu, Oct 20 2011 1:39 by Paulo Morgado | with no comments

Creating Property Set Expression Trees In A Developer Friendly Way
In a previous post I showed how to create expression trees to set properties on an object. The way I did it was not very developer friendly. It involved explicitly creating the necessary expressions because the compiler won’t generate expression trees...

Posted Wed, Jan 12 2011 2:36 by Paulo Morgado | 1 comment(s)

LINQ: Implementing The SkipLastWhile Operator
Following my last posts ( > )( > ), in this post I’ll introduce the implementation of the SkipLastWhile operator. The SkipLastWhile returns all but the last contiguous elements from a a sequence that satisfy the specified criteria and is implemented...

Posted Wed, Oct 20 2010 1:00 by Paulo Morgado | 4 comment(s)

LINQ: Implementing The SkipLast Operator
Following my last post , in this post I’ll introduce the implementation of the SkipLast operator. The SkipLast operator returns all but a specified number of contiguous elements from the end of a sequence and is implemented as the SkipLast extension method...

Posted Wed, Oct 20 2010 0:59 by Paulo Morgado | with no comments

LINQ: Introducing The Skip Last Operators
After having introduced the TakeLast operators ( > )( > )( > ), it makes sense to introduce their duals: the SkipLast operators. Name Description Example SkipLast<TSource>(IEnumerable<TSource>) Returns all but a specified number of...

Posted Wed, Oct 20 2010 0:58 by Paulo Morgado | with no comments

LINQ: Implementing The TakeLastWhile Operator
Following my last posts ( > )( > ), in this post I’ll introduce the implementation of the TakeLastWhile operator. The TakeLastWhile operator returns last contiguous elements from a sequence that satisfy the specified criteria and is implemented...

Posted Mon, Oct 18 2010 0:26 by Paulo Morgado | with no comments

LINQ: Implementing The TakeLast Operator
Following my last post , in this post I’ll introduce the implementation of the TakeLast operator. The TakeLast operator returns a specified number of contiguous elements from the end of a sequence and is implemented as the TakeLast extension method :...

Posted Mon, Oct 18 2010 0:26 by Paulo Morgado | with no comments

Hydrating Objects With Expression Trees - Part III
To finalize this series on object hydration, I’ll show some performance comparisons between the different methods of hydrating objects. For the purpose of this exercise, I’ll use this class: class SomeType { public int Id { get ; set ; } public string...

Posted Wed, Aug 18 2010 2:27 by Paulo Morgado | 2 comment(s)

Hydrating Objects With Expression Trees - Part II
In my previous post I showed how to hydrate objects by creating instances and setting properties in those instances. But, if the intent is to hydrate the objects from data, why not having an expression that does just that? That’s what the member initialization...

Posted Mon, Aug 16 2010 23:19 by Paulo Morgado | 2 comment(s)

Hydrating Objects With Expression Trees - Part I
After my post about dumping objects using expression trees , I’ve been asked if the same could be done for hydrating objects. Sure it can, but it might not be that easy. What we are looking for is a way to set properties on objects of an unknown type...

Posted Mon, Aug 16 2010 1:55 by Paulo Morgado | 2 comment(s)

Mastering Expression Trees With .NET Reflector
Following my last post , I received lots of enquiries about how got to master the creation of expression trees . The answer is: .NET Reflector On that post I needed to to generate an expression tree for this expression: Expression < Func < object...

Posted Fri, Aug 6 2010 1:40 by Paulo Morgado | 1 comment(s)

Dumping Objects Using Expression Trees
No. I’m not proposing to get rid of objects. A colleague of mine was asked if I knew a way to dump a list of objects of unknown type into a DataTable with better performance than the way he was using. The objects being dumped usually have over a...

Posted Tue, Aug 3 2010 1:36 by Paulo Morgado | 2 comment(s)

C#: More On Array Variance
In a previous post , I went through how arrays have are covariant in relation to the type of its elements, but not safely covariant. In the following example, the second assignment is invalid at run time because, although the type of the objectArray variable...

Posted Mon, Aug 2 2010 1:06 by Paulo Morgado | with no comments

Filed under: , ,

TechDays 2010: What’s New On C# 4.0
I would like to thank those that attended my session at TechDays 2010 and I hope that I was able to pass the message of what’s new on C# . For those that didn’t attend (or did and want to review it), the presentation can be downloaded from here . Code...

Posted Mon, Apr 26 2010 22:48 by Paulo Morgado | with no comments

C# 4.0: COM Interop Improvements
Dynamic resolution as well as named and optional arguments greatly improve the experience of interoperating with COM APIs such as Office Automation Primary Interop Assemblies (PIAs) . But, in order to alleviate even more COM Interop development, a few...

Posted Mon, Apr 19 2010 1:59 by Paulo Morgado | with no comments

C# 4.0: Dynamic Programming
The major feature of C# 4.0 is dynamic programming. Not just dynamic typing, but dynamic in broader sense, which means talking to anything that is not statically typed to be a .NET object. Dynamic Language Runtime The Dynamic Language Runtime ( DLR )...

Posted Sun, Apr 18 2010 19:45 by Paulo Morgado | 1 comment(s)

C# 4.0: Alternative To Optional Arguments
Like I mentioned in my last post , exposing publicly methods with optional arguments is a bad practice (that’s why C# has resisted to having it, until now). You might argument that your method or constructor has to many variants and having ten or more...

Posted Sun, Apr 18 2010 2:11 by Paulo Morgado | 4 comment(s)

More Posts Next page »