Login or Sign Up to become a member!
LessThanDot Sit Logo

LessThanDot

Desktop Developer

Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.

LTD Social Sitings

Lessthandot twitter Lessthandot Linkedin Lessthandot friendfeed Lessthandot facebook Lessthandot rss

Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.

Your profile

Search

XML Feeds

Google Ads

Category: C#

comments
Rate Post:
submit to reddit Digg!FacebookDotnetkicks

I don't know how many times I've put together the same slow regexp to check if the user input is a valid phone number. I decided that this cannot go on and developed a simple phone number primitive. Now our main concern here is the performance of TryParse since it will be used the most. After running some performance tests the median timing was 400ns on a 3Ghz machine.

csharp Sample Code (See Article for Rest)
Read More...
comments

Lazy Coding?

by chaospandion on Mar 11, 2010 in categories Microsoft Technologies, C#
Rate Post:
submit to reddit Digg!FacebookDotnetkicks

Are you waiting for .NET 4.0 to take advantage of lazy initialization? Now you don't have to. The question you need to ask yourself is why haven't I already made this myself?

Aren't we all a little lazy?

csharp Sample Code (See Article for Rest)
Read More...
comments
Rate Post:
submit to reddit Digg!FacebookDotnetkicks

Update: I added some code to handle DBNulls.

With the upcoming release of .NET 4.0 we will be seeing the new dynamic type introduced. The dynamic type bypasses static type checking and is instead checked at run-time. It was introduced to improve interoperability with dynamic languages like IronPython as well as simplifying the usage COM APIs that return objects such as the Microsoft Office API. How can we take advantage of this in other areas? ADO.NET is a perfect candidate for taking advantage of the dynamic type. The following code lays out the ground work for a n...

Read More...
comments
Rate Post:
submit to reddit Digg!FacebookDotnetkicks

For my usercontrols I tend to use the StructureMap BuildUp feature. I will leave it to the big man himself to introduce you to this feature.

I use property injection in this case because the designer doesn't like usercontrols that have constructors that are not empty, since it will try to execute the code in that constructor. So we revert to property injection and the BuildUp feature....

Read More...
comments
Rate Post:
submit to reddit Digg!FacebookDotnetkicks

Raising events on a mock is easy with Rhino mocks. I wrote a whole article about it.

Way back then I wrote,

If we try to use the same syntax on the parameterless event like so eventraiser.GetEventRaiser(e => e.event1 += null).Raise(null); we get ...

Read More...

:: Next >>