<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>.net Brainwork</title>
        <link>http://blog.vascooliveira.com/Default.aspx</link>
        <description>One framework to rule us all...</description>
        <language>en-US</language>
        <copyright>Vasco Oliveira</copyright>
        <generator>Subtext Version 2.1.2.2</generator>
        <image>
            <title>.net Brainwork</title>
            <url>http://blog.vascooliveira.com/images/RSS2Image.gif</url>
            <link>http://blog.vascooliveira.com/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <item>
            <title>MVP 2010 Summit is over. Next!</title>
            <category>ASP.NET</category>
            <category>General</category>
            <category>C#</category>
            <category>VB.NET</category>
            <category>ADO.NET</category>
            <category>WPF</category>
            <category>WCF</category>
            <category>.NET Framework 4.0</category>
            <link>http://blog.vascooliveira.com/archive/2010/02/19/mvp-2010-summit-is-over.-next.aspx</link>
            <description>&lt;p&gt;&lt;a rel="lightbox" href="http://blog.vascooliveira.com/blog/images/blog_vascooliveira_com/blog/WindowsLiveWriter/MVP2010Summitisover.Next_11E39/microsoft_mvp_logo-191x300%5B1%5D_2.png"&gt;&lt;img style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; MARGIN: 2px 10px 5px 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title="microsoft_mvp_logo-191x300[1]" border="0" alt="microsoft_mvp_logo-191x300[1]" align="left" width="100" height="157" src="http://blog.vascooliveira.com/blog/images/blog_vascooliveira_com/blog/WindowsLiveWriter/MVP2010Summitisover.Next_11E39/microsoft_mvp_logo-191x300%5B1%5D_thumb.png" /&gt;&lt;/a&gt; And that’s a rap. The 2010’s &lt;a target="_blank" href="http://www.mvpsummit2010.com"&gt;Most valuable Professional Summit&lt;/a&gt; is now over. It took place in Bellevue &amp;amp; Redmond, Washington, and for those who couldn’t be there for all the good stuff in the &lt;a target="_blank" href="http://www.mvpsummit2010.com/Agenda"&gt;agenda&lt;/a&gt;, well, eyes wide open for blogs, tweets and streams. &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;In the meantime, get yourself on the run for that distinguished MVP title and get your ticket to next year’s summit as well as your &lt;a target="_blank" href="http://www.billp.com/blog/images/mvpkit2009.jpg"&gt;trophy-kit&lt;/a&gt;. The girls will love it… I guess :o)&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Next, on April 12th, Microsoft will be pairing with &lt;a target="_blank" href="http://devconnections.com/"&gt;DevConnections&lt;/a&gt; for the Visual Studio Launch at the Bellagio Hotel and Casino in Las Vegas, NV. Microsoft will launch Visual Studio 2010, and by attending the Microsoft Visual Studio Conference &amp;amp; Expo, you will not only experience the launch alongside the Visual Studio team and industry legends - you'll get three days of sessions by the best speakers in the industry on the latest and greatest technologies, such as WPF, Silverlight and .NET 4.0.  Also, If you attend Microsoft Visual Studio Conference &amp;amp; Expo, you'll automatically get access to both the ASP.NET and Silverlight and the SQL Conference and Expo.&lt;/p&gt;&lt;img src="http://blog.vascooliveira.com/aggbug/175.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Vasco Oliveira</dc:creator>
            <guid>http://blog.vascooliveira.com/archive/2010/02/19/mvp-2010-summit-is-over.-next.aspx</guid>
            <pubDate>Fri, 19 Feb 2010 20:21:25 GMT</pubDate>
            <wfw:comment>http://blog.vascooliveira.com/comments/175.aspx</wfw:comment>
            <comments>http://blog.vascooliveira.com/archive/2010/02/19/mvp-2010-summit-is-over.-next.aspx#feedback</comments>
            <wfw:commentRss>http://blog.vascooliveira.com/comments/commentRss/175.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Object, var, dynamic and the DLR Showdown</title>
            <category>C#</category>
            <category>.NET Framework 4.0</category>
            <link>http://blog.vascooliveira.com/archive/2010/02/16/object-var-dynamic-and-the-dlr-showdown.aspx</link>
            <description>&lt;p&gt;There’s a time when new feature or frameworks arise and you get to know them and immediately grasp that new and useful way of doing things, but there are also times when clarity only comes after a bit of blurriness. From what I’ve read, the new Dynamic type in c# 4.0 is currently one of such cases, when compared to &lt;font face="Courier New"&gt;var&lt;/font&gt;. I read many developers say “What’s the point?” or “Why do I need this?”. Well, I believe it’s a matter of architectural needs, mixed with coding style. To break this discussion into pieces, and because I feel the force is strong with this one ;-) I found myself with the task of enlightening things up a bit.&lt;/p&gt;  
&lt;p&gt; &lt;/p&gt;
&lt;p align="center"&gt;- Help keep this blog alive - &lt;/p&gt;
&lt;p align="center"&gt;&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-4129356353503222";
/* 468x60, created 10/14/09 */
google_ad_slot = "5386572735";
google_ad_width = 468;
google_ad_height = 60;
//--&gt;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;  &lt;p&gt;In fact, this article hopes to settle the dust on this. I’ve seen a number of articles and posts on the web comparing and debating advantages and disadvantages, but I didn't find them clear or eligible for training purposes. And even after knowing what each one really represent and allow, their usage and necessity is somewhat cloudy. Specially when it comes to &lt;font face="Courier New"&gt;dynamic&lt;/font&gt;.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;So, to get the discussion started, I believe that we first must make sure we understand the basics of each one of these types, and build our structured thinking from there. You all know the System.Object type. Or its alias, &lt;font face="Courier New"&gt;object&lt;/font&gt;. Everything in the .Net Framework is an object, right? You can even refer to any type as object, by boxing it like this:&lt;/p&gt;  &lt;pre class="brush: csharp;"&gt;
//Boxing
object var1 = 23;

// This will produce a compiler error
object sum = 3 + var1;&lt;/pre&gt;

&lt;p&gt;Since we specified 23 as var1’s value, it will be inferred and internally assumed as System.Int32. However, adding 3 var1 produces an “Operator '+' cannot be applied to operands of type 'int' and 'object'” compiler error.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;This is where &lt;font face="Courier New"&gt;var&lt;/font&gt; comes in handy. If, instead of object we use the &lt;font face="Courier New"&gt;var&lt;/font&gt; type, the compiler will infer the underlying type and take it into consideration along the method scope. I say method scope because the &lt;font face="Courier New"&gt;var&lt;/font&gt; type can only be declared inside a method. So, the following would work: &lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;var var2 = 23;

object sum2 = 3 + var2;&lt;/pre&gt;

&lt;p&gt; You can see the differences when boxing an Int32 value, but the same kind of difference arises when unboxing. Assigning var1 to an int variable produces a compiler error “&lt;font face="Courier New"&gt;Cannot implicitly convert type ‘object’ to ‘int’&lt;/font&gt;”, suggesting a cast, while assigning var2 compiles successfully:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;// Produces compiler error
int var3 = var1;

// Compiles successfully
int var4 = var2;&lt;/pre&gt;

&lt;p&gt;&lt;font face="Courier New"&gt;var&lt;/font&gt; is still statically typed though. The only difference is, for instance, that you don’t need to repeat the type upon initialization:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;// Type is specified only once
var x = new Collection&amp;lt;int&amp;gt;();&lt;/pre&gt;

&lt;p&gt;It’s a nice bonus, but not it’s main purpose. The true purpose behind &lt;font face="Courier New"&gt;var&lt;/font&gt; is so that we can declare a strongly typed variable without needing to know the name of the variable's type. This is crucial in order to enable C# 3.0’s anonymous types. You wouldn't be able to declare a variable of an anonymous type if you always had to include the type name as part of the variable declaration. That's the main reason &lt;font face="Courier New"&gt;var&lt;/font&gt; has been added to the language.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;In some cases, when software architecture enables you to do so, you also have the advantage of changing return types without producing compilation errors.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;Consider the following two classes. Event though they are similar in functionality, they are, nevertheless, different types and so, bound to the usual rules:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;public class Human
{
    public int Age { get; set; }

    public string Name { get; set; }
}

public class Dog
{
    public int Age { get; set; }

    public string Name { get; set; }

    public string Breed { get; set; }
}&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;Now, imagine the following method from any given business layer, that returns a new instance of type Human:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;public Human GetInstance()
{
     return new Human();
}&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;And a consumption example:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;var o = GetInstance();

o.Name = "Alex";
o.Age = 23;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;If, in the future, someone changes &lt;font face="Courier New"&gt;GetIntance()&lt;/font&gt;’s return type to &lt;font face="Courier New"&gt;Dog&lt;/font&gt;, you won’t need to change the previous code, because the same rules apply to the new type, since &lt;font face="Courier New"&gt;var&lt;/font&gt;’s type is implicit. Weird architectural approach, but an advantage to consider nevertheless.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;And then there’s the &lt;font face="courier "&gt;dynamic&lt;/font&gt; type. &lt;font face="courier "&gt;dynamic&lt;/font&gt; is a static type, but an object of type &lt;font face="courier "&gt;dynamic&lt;/font&gt; bypasses static type checking. It’s like a type closing the door to the compiler when he knocks asking who’s in. And, as such, you don’t get the usual intellisence information. You’ll simply get the following:&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="http://blog.vascooliveira.com/blog/images/blog_vascooliveira_com/blog/WindowsLiveWriter/ObjectVarandDynamicShowdown_9005/dynamic_2.gif" rel="lightbox"&gt;&lt;img style="display: block; float: none; margin-left: auto; margin-right: auto" title="dynamic" alt="dynamic" src="http://blog.vascooliveira.com/blog/images/blog_vascooliveira_com/blog/WindowsLiveWriter/ObjectVarandDynamicShowdown_9005/dynamic_thumb.gif" width="399" height="163" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;At compile time, an element that is typed as &lt;font face="courier "&gt;dynamic&lt;/font&gt; is assumed to support any operation. He simply doesn’t know what it is, nor where it comes from. You are in control :)&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;dynamic var1 = 23;

// Sum operation resolves successfully.
object sum1 = 3 + var1;

// This also works
int var2 = var1;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;As you see in the previous snippet, it behaves just like &lt;font face="Courier New"&gt;var&lt;/font&gt;, but without intellisence. “No intellisence? Why bother then??” - you ask. We’ll get to that shortly. For now, consider the following extended Human class:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;public class Human
{
    public int Age { get; set; }

    public string Name { get; set; }

    public void Punch(int intensity)
    {
        Console.WriteLine(string.Format("Punched with {0} strength.", intensity));
    }
}&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;A typical consumption example would be:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;Human h = new Human();
h.Punch(100);&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;But if we used dynamic, we could do this:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;dynamic h = new Human();
h.Punch(100, "Right in the face!");&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;Even though there’s no corresponding method signature in the Human class, the dynamic type made the compiler became passive, and he didn’t analyze the underlying/resolving type. So the snipped compiles just fine, but resulting in a runtime error later on. &lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;The dynamic type has a broader usage than &lt;font face="Courier New"&gt;var&lt;/font&gt;. It can be used as a property, field, indexer, parameter, return value, local variable, or type constraint; it can be the target of an explicit conversion and it can be the right side assignment of both is or as operators or &lt;font face="Courier New"&gt;typeof&lt;/font&gt; argument. The following example demonstrates some of these arguments:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;public MainWindow()
{
    InitializeComponent();

    // Prints ".net Brainwork rocks!" to the output window
    Console.WriteLine(ExampleMethod(23));
}

public dynamic ExampleMethod(dynamic number)
{
    dynamic dyn;

    int num = number;
    dyn = (dynamic)num;

    string str = ".net Brainwork rocks!";
    dyn = (dynamic)str;

    return dyn;
}&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;So what the dynamic type really does is telling the compiler to skip operation analysis and validation at design time, and instead, it resolves the types and operations at runtime. It accomplishes this through a new engine called Dynamic Language Runtime. The dynamic language runtime (DLR) is a new .Net Framework 4.0 runtime environment that adds a set of services for dynamic languages to the common language runtime (CLR). The DLR makes it easier to develop dynamic languages to run on the .NET Framework and to add dynamic features to statically typed languages. IronRuby and IronPython are two examples of languages developed by using the DLR. &lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;Dynamic languages can identify the type of an object at run time, whereas in statically typed languages such as C# you must specify object types at design time.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;The purpose of the DLR is to enable a system of dynamic languages to run on the .NET Framework and give them .NET interoperability. The DLR introduces dynamic objects to C# and Visual Basic in Visual Studio 2010 to support dynamic behavior in these languages and enable their interoperation with dynamic languages. &lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;So, all in all, dynamic has an entirely new operation going on. It’s not just a matter of making it easier for developers to produce code or improve its quality, but it’s a new system for dynamic type handling, that improves how the language interacts with external data objects or services, whose types are only known at runtime like COM.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;References:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd233052(VS.100).aspx" target="_blank"&gt;Dynamic Language Runtime Overview&lt;/a&gt; - MSDN&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
Technorati Tags: &lt;a href="http://technorati.com/tags/C%23" rel="tag"&gt;C#&lt;/a&gt;, &lt;a href="http://technorati.com/tags/.NET+Framework+4.0" rel="tag"&gt;.NET Framework 4.0&lt;/a&gt;&lt;img src="http://blog.vascooliveira.com/aggbug/174.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Vasco Oliveira</dc:creator>
            <guid>http://blog.vascooliveira.com/archive/2010/02/16/object-var-dynamic-and-the-dlr-showdown.aspx</guid>
            <pubDate>Tue, 16 Feb 2010 20:31:00 GMT</pubDate>
            <wfw:comment>http://blog.vascooliveira.com/comments/174.aspx</wfw:comment>
            <comments>http://blog.vascooliveira.com/archive/2010/02/16/object-var-dynamic-and-the-dlr-showdown.aspx#feedback</comments>
            <wfw:commentRss>http://blog.vascooliveira.com/comments/commentRss/174.aspx</wfw:commentRss>
        </item>
        <item>
            <title>ASP.NET MVC 2 Release Candidate 2 Released</title>
            <link>http://blog.vascooliveira.com/archive/2010/02/05/asp.net-mvc-2-release-candidate-2-released.aspx</link>
            <description>&lt;p&gt;The ASP.NET team shipped ASP.NET MVC 2 Release Candidate 2 for VS 2008/.NET 3.5, and it’s the sequel to the RC version made available in December. It features bug fixes, performance optimizations, and API and behavior additions/changes.  Below are a few of the changes between the RC1 and RC2 release (read the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=7aba081a-19b9-44c4-a247-3882c8f749e3&amp;amp;displaylang=en"&gt;release notes&lt;/a&gt; for even more details):&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The new &lt;a href="http://weblogs.asp.net/scottgu/archive/2010/01/15/asp-net-mvc-2-model-validation.aspx"&gt;ASP.NET MVC 2 validation&lt;/a&gt; feature now performs model-validation instead of input-validation (this means that when you use model binding all model properties are validated instead of just validations on changed values of a model).  This behavior change was based on extensive feedback from the community. &lt;/li&gt; &lt;/ul&gt;  &lt;ul&gt;   &lt;li&gt;The new &lt;a href="http://weblogs.asp.net/scottgu/archive/2010/01/10/asp-net-mvc-2-strongly-typed-html-helpers.aspx"&gt;strongly-typed HTML input helpers&lt;/a&gt; now support lambda expressions which reference array or collection indexes.  This means you can now write code like &lt;em&gt;Html.EditorFor(m=&amp;gt;m.Orders[i])&lt;/em&gt; and have it correctly output an HTML &amp;lt;input&amp;gt; element whose “name” attribute contains the index (e.g. Orders[0] for the first element), and whose “value” contains the appropriate value. &lt;/li&gt; &lt;/ul&gt;  &lt;ul&gt;   &lt;li&gt;The new templated Html.EditorFor() and Html.DisplayFor() helper methods now auto-scaffold simple properties (and do not render complex sub-properties by default).  This makes it easier to generate automatic scaffolded forms.  I’ll be covering this support in a future blog post. &lt;/li&gt; &lt;/ul&gt;  &lt;ul&gt;   &lt;li&gt;The “id” attribute of client-script validation message elements is now cleaner.  With RC1 they had a &lt;em&gt;form0_&lt;/em&gt; prefix.  Now the id value is simply the input form element name postfixed with a validationMessage string (e.g. &lt;em&gt;unitPrice_validationMessage&lt;/em&gt;). &lt;/li&gt; &lt;/ul&gt;  &lt;ul&gt;   &lt;li&gt;The Html.ValidationSummary() helper method now takes an optional boolean parameter which enables you to control whether only model-level validation messages are rendered by it, or whether property level validation messages are rendered as well.  This provides you with more UI customization options for how validation messages are displayed within your UI. &lt;/li&gt; &lt;/ul&gt;  &lt;ul&gt;   &lt;li&gt;The AccountController class created with the default ASP.NET MVC Web Application project template is cleaner. &lt;/li&gt; &lt;/ul&gt;  &lt;ul&gt;   &lt;li&gt;Visual Studio now includes scaffolding support for Delete action methods within Controllers, as well as Delete views (I always found it odd that the default T4 templates didn’t support this before). &lt;/li&gt; &lt;/ul&gt;  &lt;ul&gt;   &lt;li&gt;jQuery 1.4.1 is now included by default with new ASP.NET MVC 2 projects, along with a –vsdoc file that provides Visual Studio documentation intellisense for it. &lt;/li&gt; &lt;/ul&gt;  &lt;ul&gt;   &lt;li&gt;The RC2 release has some significant performance tuning improvements (for example: the lambda based strongly-typed HTML helpers are now much faster). &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Today’s RC2 release only work with VS 2008 and .NET 3.5.  We’ll shortly be releasing the VS 2010 RC (which will be available for everyone to download). It will include ASP. NET MVC 2 support built-in (no separate download required).&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;You can download it &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=7aba081a-19b9-44c4-a247-3882c8f749e3&amp;amp;displaylang=en"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Source: ScottGu&lt;/p&gt;&lt;img src="http://blog.vascooliveira.com/aggbug/173.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Vasco Oliveira</dc:creator>
            <guid>http://blog.vascooliveira.com/archive/2010/02/05/asp.net-mvc-2-release-candidate-2-released.aspx</guid>
            <pubDate>Fri, 05 Feb 2010 10:57:57 GMT</pubDate>
            <wfw:comment>http://blog.vascooliveira.com/comments/173.aspx</wfw:comment>
            <comments>http://blog.vascooliveira.com/archive/2010/02/05/asp.net-mvc-2-release-candidate-2-released.aspx#feedback</comments>
            <wfw:commentRss>http://blog.vascooliveira.com/comments/commentRss/173.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Visual Studio 2008 SP1 WPF Designer Crash</title>
            <link>http://blog.vascooliveira.com/archive/2010/01/08/visual-studio-2008-sp1-wpf-designer-crash.aspx</link>
            <description>&lt;p&gt;I’m at it again. Yesterday when working on a simplistic WPF form for a user profile configuration scenario, Visual Studio did it again with a bang, crashing in all it’s glory when switching to designer view.&lt;/p&gt;  &lt;p&gt;What solved the problem? Well… Erasing the solution .suo file so that the IDE doesn’t crash on startup if, by any chance, a xaml document is open in design view, and installing the following hotfix made available by Microsoft:&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://code.msdn.microsoft.com/KB963035" target="_blank"&gt;KB963035 - VS2008 SP1 sometimes hangs irretrievably after WPF Designer&lt;/a&gt;&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;This hotfix relates to the Visual Studio IDE hanging, not crashing. But nevertheless It can be a valuable contribution to solving the problem.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Cleaning the solution also solved the problem in some cases, from what I’ve read and heard.&lt;/p&gt;&lt;img src="http://blog.vascooliveira.com/aggbug/172.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Vasco Oliveira</dc:creator>
            <guid>http://blog.vascooliveira.com/archive/2010/01/08/visual-studio-2008-sp1-wpf-designer-crash.aspx</guid>
            <pubDate>Fri, 08 Jan 2010 10:20:11 GMT</pubDate>
            <wfw:comment>http://blog.vascooliveira.com/comments/172.aspx</wfw:comment>
            <comments>http://blog.vascooliveira.com/archive/2010/01/08/visual-studio-2008-sp1-wpf-designer-crash.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://blog.vascooliveira.com/comments/commentRss/172.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Design-time width and height in WPF/Silverlight</title>
            <category>Silverlight</category>
            <category>WPF</category>
            <link>http://blog.vascooliveira.com/archive/2009/12/15/design-time-width-and-height-in-wpfsilverlight.aspx</link>
            <description>&lt;p&gt;When designing UI’s in WPF and Silverlight, you may wish to make your layout fluid and auto-expandable in order to take the most out changing UI context. For instance, when data quantity and quality changes, available space may also change and objects in the layout need to adapt to these changes. When an auto layout is needed, no width nor height are specified which can be troublesome since the design view tends to collapse available space. For instance, a variable size user control with a data-binded listbox has no child items in design time, so you’ll see nothing but a small dot. This is because Cider, the Visual Studio Designer, and Blend designer, have no reason to show it otherwise since there’s no content and, as such, the ability to publish and preview isn’t possible.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;In expression blend however, there’s a nice feature that solves this issue, and it’s only enabled at design time. When you create a new visual object in Blend, you’ll notice the following xml namespace declaration:&lt;/p&gt;  &lt;pre class="brush: xml;"&gt;...
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
...&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;This enabled a “d” keyword that can be attached to a visual object in order to set its size only at design time. At runtime, the regular sizing settings are considered. So, if we had the following User Control, with data items applied at runtime through databinding:&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;&amp;lt;UserControl x:Class="NetBrainwork.Temp"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&amp;gt;
    &amp;lt;ListBox Name="DemoListBox" ItemsSource="{Binding MyCollection}"&amp;gt;&amp;lt;/ListBox&amp;gt;
&amp;lt;/UserControl&amp;gt;&lt;/pre&gt;

&lt;p&gt;This is what you would see in Blend:&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="http://vascooliveira.com/blog/images/vascooliveira_com/blog/WindowsLiveWriter/DesigntimewidthandheightinWPFSilverlight_A508/usercontrolauto.jpg" rel="lightbox"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="usercontrolauto" border="0" alt="usercontrolauto" src="http://vascooliveira.com/blog/images/vascooliveira_com/blog/WindowsLiveWriter/DesigntimewidthandheightinWPFSilverlight_A508/usercontrolauto_thumb.jpg" width="95" height="89" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;So you see that testing background coloring, for instance, isn’t very practical with this view. So the solution lies in the two Blend design-time attached properties: DesignWidth and DesignHeight, available in the namespace specified above. Notice the two right and bottom rectangular adorners in the previous picture: they’re Blend’s way of settings these values. If you resize your control with those rectangles you’ll be setting your desired design-time size. The XAML output would be something like this:&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;&amp;lt;UserControl x:Class="WpfUnderTheHood.Temp"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="200" d:DesignHeight="200"&amp;gt;
    &amp;lt;ListBox Name="DemoListBox" ItemsSource="{Binding MyCollection}"&amp;gt;&amp;lt;/ListBox&amp;gt;
&amp;lt;/UserControl&amp;gt;&lt;/pre&gt;

&lt;p&gt;And this is what you’d see:&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="http://vascooliveira.com/blog/images/vascooliveira_com/blog/WindowsLiveWriter/DesigntimewidthandheightinWPFSilverlight_A508/usercontrolauto2.jpg" rel="lightbox"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="usercontrolauto2" border="0" alt="usercontrolauto2" src="http://vascooliveira.com/blog/images/vascooliveira_com/blog/WindowsLiveWriter/DesigntimewidthandheightinWPFSilverlight_A508/usercontrolauto2_thumb.jpg" width="240" height="237" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p /&gt;

&lt;p&gt;Like I said earlier, at runtime this setting isn’t considered, and auto layout is applied.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;
Technorati Tags: &lt;a href="http://technorati.com/tags/WPF" rel="tag"&gt;WPF&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Silverlight" rel="tag"&gt;Silverlight&lt;/a&gt;&lt;img src="http://blog.vascooliveira.com/aggbug/171.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Vasco Oliveira</dc:creator>
            <guid>http://blog.vascooliveira.com/archive/2009/12/15/design-time-width-and-height-in-wpfsilverlight.aspx</guid>
            <pubDate>Tue, 15 Dec 2009 11:49:56 GMT</pubDate>
            <wfw:comment>http://blog.vascooliveira.com/comments/171.aspx</wfw:comment>
            <comments>http://blog.vascooliveira.com/archive/2009/12/15/design-time-width-and-height-in-wpfsilverlight.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://blog.vascooliveira.com/comments/commentRss/171.aspx</wfw:commentRss>
        </item>
        <item>
            <title>MEF and Prism on .NET Framework 4.0</title>
            <category>C#</category>
            <category>WPF</category>
            <link>http://blog.vascooliveira.com/archive/2009/12/09/mef-and-prism-on-.net-framework-4.0.aspx</link>
            <description>&lt;p&gt;David Hill from the patterns &amp;amp; practices team posted a very interesting article concerning MEF and Prism. It talks about the benefits your applications get from using these extensibility technologies, but also clears some misunderstandings regarding their purpose. I’ve been faced with this question several times and the online community reflects this same common overlap. While MEF is purely an extensibility API, Prism is a development pattern that allows you to organize and manage your WPF/Silverlight project through modularity and thus isolate requirement and functionality concerns in development teams.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;They’re both part of .NET Framework 4.0 and a MUST if you are developing big applications and/or needing your software to be extensible.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Check out the article &lt;a href="http://blogs.msdn.com/dphill/archive/2009/12/09/prism-and-mef.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
Technorati Tags: &lt;a rel="tag" href="http://technorati.com/tags/MEF"&gt;MEF&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/Prism"&gt;Prism&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/WPF"&gt;WPF&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/Silverlight"&gt;Silverlight&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/.NET+Framework+4.0"&gt;.NET Framework 4.0&lt;/a&gt;&lt;img src="http://blog.vascooliveira.com/aggbug/170.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Vasco Oliveira</dc:creator>
            <guid>http://blog.vascooliveira.com/archive/2009/12/09/mef-and-prism-on-.net-framework-4.0.aspx</guid>
            <pubDate>Wed, 09 Dec 2009 14:44:06 GMT</pubDate>
            <wfw:comment>http://blog.vascooliveira.com/comments/170.aspx</wfw:comment>
            <comments>http://blog.vascooliveira.com/archive/2009/12/09/mef-and-prism-on-.net-framework-4.0.aspx#feedback</comments>
            <wfw:commentRss>http://blog.vascooliveira.com/comments/commentRss/170.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Microsoft CDN now with SSL support</title>
            <category>ASP.NET</category>
            <category>Javascript</category>
            <link>http://blog.vascooliveira.com/archive/2009/11/30/microsoft-cdn-now-with-ssl-support.aspx</link>
            <description>&lt;p&gt;&lt;img hspace="10" alt="" align="left" src="http://hostek.com/images/logo_aspdotnet.gif" /&gt;Following September's launch of the new Microsoft CDN (Content Delivery Network Service), in which you can reference ajax libraries in cache, Microsoft recently added SSL support, thus confirming Microsoft's announcement back then. This new feature is necessary in websites that have SSL enabled pages and script library references in them. What would happen until now was a message displaying "This page contains both secure and non-secure items...". &lt;/p&gt;
&lt;p&gt;SSL support is now enabled with the scripts hosted on the Microsoft AJAX CDN. Simply use an “https” moniker with any script references on your site that point to the CDN, and they will now be served over SSL. For example, below is how you can reference jQuery over SSL: &lt;/p&gt;
&lt;pre class="brush: javascript"&gt;&amp;lt;script src="https://ajax.microsoft.com/ajax/jquery/jquery-1.3.2.min.js" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/pre&gt;
&lt;p&gt; For more information, check out the Microsoft Ajax &lt;a href="http://www.asp.net/ajaxLibrary/cdn.ashx"&gt;Content Delivery Network website&lt;/a&gt;. At the bottom there's a useful list of ASP.NET Ajax Libraries hosted on the CDN.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Technorati tags: &lt;a rel="tag" href="http://technorati.com/tags/ASP.NET"&gt;ASP.NET&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/Javascript"&gt;Javascript&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Technorati verify: 4J8KBSATVCQV&lt;/p&gt;&lt;img src="http://blog.vascooliveira.com/aggbug/169.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Vasco Oliveira</dc:creator>
            <guid>http://blog.vascooliveira.com/archive/2009/11/30/microsoft-cdn-now-with-ssl-support.aspx</guid>
            <pubDate>Mon, 30 Nov 2009 11:16:17 GMT</pubDate>
            <wfw:comment>http://blog.vascooliveira.com/comments/169.aspx</wfw:comment>
            <comments>http://blog.vascooliveira.com/archive/2009/11/30/microsoft-cdn-now-with-ssl-support.aspx#feedback</comments>
            <wfw:commentRss>http://blog.vascooliveira.com/comments/commentRss/169.aspx</wfw:commentRss>
        </item>
        <item>
            <title>jQuery Javascript Library Tutorial Part 2</title>
            <category>Javascript</category>
            <link>http://blog.vascooliveira.com/archive/2009/11/24/jquery-javascript-library-tutorial-part-2.aspx</link>
            <description>&lt;p&gt;Just posted another article from a series of articles regarding the jQuery Library. This next iteration explains all the major areas of this magnificent API, and targets element selection and filtering through some basic explanation and examples. Don't miss out if you're getting into jQuery.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="http://blog.vascooliveira.com/articles/tutorial-jquery-javascript-library-part-1.aspx"&gt;jQuery Tutorial Part 1&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blog.vascooliveira.com/articles/tutorial-jquery-javascript-library-part-2.aspx"&gt;jQuery Tutorial Part 2&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blog.vascooliveira.com/aggbug/166.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Vasco Oliveira</dc:creator>
            <guid>http://blog.vascooliveira.com/archive/2009/11/24/jquery-javascript-library-tutorial-part-2.aspx</guid>
            <pubDate>Tue, 24 Nov 2009 14:40:29 GMT</pubDate>
            <wfw:comment>http://blog.vascooliveira.com/comments/166.aspx</wfw:comment>
            <comments>http://blog.vascooliveira.com/archive/2009/11/24/jquery-javascript-library-tutorial-part-2.aspx#feedback</comments>
            <wfw:commentRss>http://blog.vascooliveira.com/comments/commentRss/166.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Silverlight 4 Out-Of-Browser features</title>
            <category>Silverlight</category>
            <link>http://blog.vascooliveira.com/archive/2009/11/23/silverlight-4-out-of-browser-features.aspx</link>
            <description>&lt;p&gt;Saw a great vide this weekend about Silberlight 4’s new OOB capabilities. Joe Stegman, Director of Program Management on the Silverlight team, went on camera in Channel 9 to talk about &lt;a href="http://silverlight.net/getstarted/silverlight-4-beta/#tools"&gt;Silverlight 4's&lt;/a&gt; Out of Browser improvements. OOB means that you can run a Silverlight application on your desktop, outside the usual browser enviroment.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Check it out here: &lt;a href="http://channel9.msdn.com/posts/Charles/Joe-Stegman-Silverlight-4-Out-of-Browser-Evolves/"&gt;Channel 9&lt;/a&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
Technorati Tags: &lt;a href="http://technorati.com/tags/Silverlight" rel="tag"&gt;Silverlight&lt;/a&gt;&lt;img src="http://blog.vascooliveira.com/aggbug/164.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Vasco Oliveira</dc:creator>
            <guid>http://blog.vascooliveira.com/archive/2009/11/23/silverlight-4-out-of-browser-features.aspx</guid>
            <pubDate>Mon, 23 Nov 2009 17:28:01 GMT</pubDate>
            <wfw:comment>http://blog.vascooliveira.com/comments/164.aspx</wfw:comment>
            <comments>http://blog.vascooliveira.com/archive/2009/11/23/silverlight-4-out-of-browser-features.aspx#feedback</comments>
            <wfw:commentRss>http://blog.vascooliveira.com/comments/commentRss/164.aspx</wfw:commentRss>
        </item>
        <item>
            <title>PDC 2009: Windows 2008 in 2012</title>
            <category>PDC 2009</category>
            <category>Windows 8</category>
            <link>http://blog.vascooliveira.com/archive/2009/11/23/pdc-2009-windows-2008-in-2012.aspx</link>
            <description>&lt;p&gt;At the Professional Developers Conference 2009, Microsoft announced public beta of Office Professional Plus 2010 productivity suite. In all the fanfare, Stephen Chapman of Microsoft Kitchen managed to grab a &lt;a href="http://msftkitchen.com/2009/11/windows-8-more-roadmaps.html"&gt;Microsoft roadmap&lt;/a&gt; pointing next Windows operating system's arrival. &lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;&lt;a href="http://vascooliveira.com/blog/images/vascooliveira_com/blog/WindowsLiveWriter/PDC2009Windows2008in2012_8E52/windows8roadmap1%5B1%5D.png" rel="lightbox"&gt;&lt;img style="border-right-width: 0px; margin: 0px 10px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="windows8roadmap1[1]" border="0" alt="windows8roadmap1[1]" align="left" src="http://vascooliveira.com/blog/images/vascooliveira_com/blog/WindowsLiveWriter/PDC2009Windows2008in2012_8E52/windows8roadmap1%5B1%5D_thumb.png" width="240" height="180" /&gt;&lt;/a&gt; Microsoft launched Windows 7 on October 22 and now the plans of Windows 8 roadmap were spotted on the Interwebs. The successor to Windows 7 is tentatively codenamed as Windows 8 and is expected to be next "Major Release" in 2012. On the contrary, Windows 7 is being treated as "Release Updates" - to what? Maybe the wild Vista code. &lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;This means there will be a three year gap till next Windows Operating system and their rival Apple believes in keeping two year gap - between Leopard and Snow Leopard. In these two-three years, both OS-making giants want the consumers to get used the new technologies incorporated in their OS and be ready for new ones.&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;Before you start making Windows 8 features wishlist, start using Windows 7 extensively and then list down what you wish to see next. Obviously, Gamers would love to go for DirectX12 and who knows what would be incorporated in it. &lt;/p&gt;  &lt;p&gt; &lt;/p&gt; Technorati Tags: &lt;a href="http://technorati.com/tags/PDC+2009" rel="tag"&gt;PDC 2009&lt;/a&gt;, &lt;a href="http://technorati.com/tags/Windows+8" rel="tag"&gt;Windows 8&lt;/a&gt;&lt;img src="http://blog.vascooliveira.com/aggbug/167.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Vasco Oliveira</dc:creator>
            <guid>http://blog.vascooliveira.com/archive/2009/11/23/pdc-2009-windows-2008-in-2012.aspx</guid>
            <pubDate>Mon, 23 Nov 2009 10:01:00 GMT</pubDate>
            <wfw:comment>http://blog.vascooliveira.com/comments/167.aspx</wfw:comment>
            <comments>http://blog.vascooliveira.com/archive/2009/11/23/pdc-2009-windows-2008-in-2012.aspx#feedback</comments>
            <wfw:commentRss>http://blog.vascooliveira.com/comments/commentRss/167.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>