Bill Blogs in C#

Bill Wagner discusses C#, LINQ, and other items of interest

Browse by Tags

All Tags » C# General » DevCenterPosts (RSS)
Euler Problem 10
Patrick posted his solution earlier this week. I figure it was time to add mine. Also, Octavio Hernandez pointed out in the comments to problem 8 that he had discussed similar code constructs in his blog a while back. Problem 10 asks for the sum of all...

Posted by wwagner | 2 comment(s)

Code from Lightning Talk: Compiler Tricks
My last Lightning Talk should how you can mix constructor calls and object initializers. It's a useful technique that can keep you from writing too much code you don't need. To see what I mean, start with this simple person class: 1: class Person...

Posted by wwagner | 2 comment(s)

Euler Problem 7
Yes, it's true that I've been very lax in working on these problems. It's been a combination of the day job, finishing all the editing tasks on "More Effective C#", and actually trying to keep the personal life intact. The 7th problem...

Posted by wwagner | 7 comment(s)

Overload Resolution on Extension Methods
I had a question from a colleague the other day about extension methods. I'm simplifying a little, but he was looking for a way to ensure that every source file used the same set of extension methods. There is one way to enforce this, but it does...

Posted by wwagner | 1 comment(s)

A Functional Programming Q & A
I received this question in email from one of my readers, and I thought it would be of general interest: I find myself with two arrays of the same size and I want to create a third that combines each element. What I want is something similar to var S3...

Posted by wwagner | 2 comment(s)

Notes on Euler Problem 3
Here are my notes on the third Project Euler problem. The problem is "What is the largest prime factor of the number 600,851,475,143?" Once again, this is a problem that is best solved creating some simple LINQ queries. From the outside, this...

Posted by wwagner | 5 comment(s)

Discussion on Project Euler Problem 2
The second Euler problem asks you to find the sum of all even valued terms in the Fibonacci sequence which do not exceed 4,000,000. Let's look at the solution from the outside in. Here's the query that finds the answer: var EvenFibNumbers = (from...

Posted by wwagner | with no comments

Do I write software at home like I write at work?
Dave Donaldson asks " Do you write software at homer like you do at work? " Dave wonders if we use the same discipline writing software at home (for our own use) that we do at work. I think the question is great, but I'm concerned about...

Posted by wwagner | with no comments

Looking Inside C# Closures
If you're like me, you understand new language features better when you see what the new language features generate for you. Closures in C# are no different. There's quite a bit that goes on under the covers in a C# closure. Looking at all the...

Posted by wwagner | 4 comment(s)

Yet another use for Extension methods : Extending IComparable<T>
I keep finding more uses for extension methods. This time it's extending IComparable<T>. The API signature for IComparable<T> has been around since the dawn of C: if the left is less than the right, return something less than 0, if left...

Posted by wwagner | 4 comment(s)