web 2.0

My Quest for a Codeless User Interface

There is not doubt about it.  I love XAML!  Coming from someone with a web application background, I understand the importance of using markup to define visual traits of an application.  I also understand that the transition from HTML to XAML is very smooth and will lead to a new generation of .NET developers who design user experiences for both the desktop and web.  What I have yet to see, is a complex User Interface written without a lot of unnecessary code-behind.  XAML was designed so that you keep all of your user-interface logic in the markup and your business logic will dominate your code behind and libraries.  Unfortunately, I have yet to see this pattern manifest.

More...

Tags:

.NET | C# | Silverlight | WPF

Lambda What? Lambda Who?

I promise this is a short post.  I have recently fallen in love with LINQ, but more recently I have grown to appreciate Lambda expressions.  I don’t know if this is because I find them simple to read, or because I once took a class as an undergraduate student where we built a modern language compiler using just Lambda expressions.  One of the things I notice often is the lack of Lambda expressions in C# 3.0 code that I read at different employers. 

More...

Tags: ,

.NET | C#

Utility Extension Methods cont’d

I rather enjoy this theme.  I find extension methods very useful when you have to repeat the same short group of code again & again.  Here a few other extension methods that I find handy.

More...

Tags: ,

.NET | C#

Utility Extension Methods

I realize that every time I post code, although I'm still a rookie in this sport, I'm putting my neck out there for some serious criticism.  But, that’s the only way to have fun in the dev world.  Ever since the introduction of Extension Methods in C# 3.0, I find myself writing a lot of utility methods.  By making them Extension methods, I make my code a lot easier to read and I just enjoy the syntax of extension methods anyways.  I’m listing a few of mine that I keep handy for many projects over time.

More...

Tags: ,

.NET | C#

LINQ Musings

 

I was recently reading Justin Etheredge’s blog and he had a really cool post about working on a simple LINQ algorithm to make it run faster http://www.codethinked.com/post/2010/01/10/The-TekPub-LINQ-Challenge-Part-2-Faster-Algorithms.aspx. Since I am learning about LINQ, and more importantly trying to study Parallel LINQ, I decided to play with his code and use the .NET Stopwatch class to see what the performance was on my xenon core 4GB 32-bit desktop. While working on the console application, I ran across this comment:

Jonas ElfströmWhy not enumerate from 2 so that you don't have to x!=1 20,000,000 times?
var primes = Enumerable.Range(2,20000000).AsParallel()
.Where(x => !Enumerable.Range(2, (int)Math.Sqrt(x)).Any(y => x != y && x % y == 0));
I'm not sure of the overhead of AsParallel() but you could also try to filter out the even numbers before AsParallel with something like
Enumerable.Range(2,20000000).Where(n => n % 2 != 0) - see
alicebobandmallory.com/.../the-thrush-combinator-in-c for more examples.
You will lose the only even prime number from the result but that could be added manually.

Sweden Jonas Elfström January 12. 2010 05:43

More...

Tags:

C# | LINQ