Welcome to WindowsClient.net | Sign in | Join

Zuker On Foundations

The realm of .NET (WPF, WCF and all around)

October 2008 - Posts

PDC 08 had started, WHOA!

The PDC had started, Unfortunately - I'm not there.

Next time I hope :)

Lots of buzz is out there already!

- Visual Studio 2010 and .NET 4.0 CTP is available for download!

- Windows Azure
Windows® Azure is a cloud services operating system that serves as the development, service hosting and service management environment for the Azure Services Platform. Windows Azure provides developers with on-demand compute and storage to host, scale, and manage Web applications on the Internet through Microsoft® data centers.

- More Oslo specifics, follow to this post.

Posted: Oct 28 2008, 10:43 AM by zuker | with no comments
Filed under: ,
T4 (Text Template Transformation Toolkit) Code Generation

I had no idea.. but but.. but but.. :)

Great thing!

Check Scott's post for all the details.

"What's the story? Well, T4 is a code generator built right into Visual Studio. To be clear, you HAVE THIS NOW on your system…go play. Now's the time to introduce code generation to your company. If you're doing something twice or more, manually, in your company, generate it."

Posted: Oct 15 2008, 08:32 AM by zuker | with no comments
Filed under: ,
Silverlight 2 is here

The final release of Silverlight 2 is out.

Download Silverlight 2 SDK, Developer Tools and Expression Blend 2 Here,

Read Scott Gu's post for more details.

Posted: Oct 14 2008, 01:26 PM by zuker | with no comments
Filed under:
C# Lambda and Extensions to help around Casting

One of the common scenarios of casting in daily use of code is the need to check if an instance is of a given type, if so - perform actions on it.

Some developers tend to do as following:

if (foo is Bar)
{
    Bar b1 = (Bar)foo;
    //Do Stuff..
}

A word about it - this approach is condered wasteful in this case.
This is because the result of whether the instance is of a 'Bar' type is not the only thing that matters in this case, meaning I still need to cast it and perform actions on it as 'Bar' type.

This is better in this case:

Bar b2 = foo as Bar;
if (b2 != null)
{
   //Do Stuff
}

In this example, we first perform the cast, next we then simpy check if the casting succeeded.

I decided to write a small helper for this common thing.

Step 1 - Try Cast

public static bool TryCast<T>(object source, out T target) where T : class
{
    target = source
as T;
    return (target != null);
}

//playing around - step 1
Bar b3;
if (Extensions.TryCast<Bar>(foo, out b3))
{
    //Do stuff
}

Step 2 - Try Cast & Perform

public static void TryCastPerform<T>(object source, Action<T> action) where T : class
{
    T cast;
    if (TryCast<T>(source, out cast))
    {
        action(cast);
    }
}

//playing around - step 2
Extensions.TryCastPerform(foo,
    (
Bar b4) =>
    {
       //Do Stuff
    });

Using Extensions:
Step 3 - Try Cast & Perform Extension

public static void TryCastPerformExt<T>(this object source, Action<T> action) where T : class
{
    TryCastPerform<T>(source, action);
}

//playing around - step 3
foo.TryCastPerformExt((Bar b5) =>
{
   //Do Stuff
});

Sample code is attached
In order to view the attached files, make sure you enter the specifc post page.

Posted: Oct 07 2008, 08:33 AM by zuker | with no comments
Filed under:
What is new in .NET 4.0?

There's a whole buzz about the .NET Framework 4.0, sweet stuff is coming.

Read Damir's post for more information.

Obviously, this isn't everything..
- There will be new modeling and architecture tools for working against the code
- The Team Developer and Database suites will be combined together - Love that!
And much more of course

 

Posted: Oct 06 2008, 11:32 AM by zuker | with no comments
Filed under:
Dynamite: High Performace Dynamic Sorting Using Expressions

Visit the CodeProject article for futher details.

Download Dynamite library (including demo) - 35.7KB

The library proides easy way for sorting arrays, enumerables, queryables and dataset as well.
The sweet gem about it is the ability to integrate it into actual runtime needs since it works with string manipulations.

Posted: Oct 02 2008, 09:32 AM by zuker | with no comments
Filed under:
Page view counter