All Tags » C# (RSS)

Browse Blog Posts by Tags

Showing related tags and posts for the Blogs application. See all tags in the site
  • Identifying Control Templates Parts in WPF

    I'm currently writing the chapter about control templates in our WPF book , and I wanted to include a list of all of the named parts that are hidden away in the dark recesses of the various controls. Before I even started googling, I had an idea that I thought I'd share. For those of you not...
    Posted to Christopher Bennage by Christopher Bennage on 03-09-2008
    Filed under: Filed under: , ,
  • Cold, Hard, Cache!

    Don't get me wrong, I really like the Asp.Net Cache (or HttpRuntime.Cache or Uncle Daddy if you want to call it that... you're a little odd aren't you?), but sometimes it just can't be trusted. I mean, I just gave you (the cache) my precious object a second ago and now you claim you don't...
    Posted to Alan Northam by anortham on 03-06-2008
    Filed under: Filed under: , , ,
  • Discovering Empty Try/Catch Blocks

    I've been burned by a few bugs recently due to swallowed exceptions. In case you don't know, empty catch blocks will hurt you. Really, they will. I wanted a way to locate all of the empty blocks in our code base, I was playing around with NDepend and the amazing Code Query Language , but it's...
    Posted to Christopher Bennage by Christopher Bennage on 02-21-2008
    Filed under: Filed under: , ,
  • The Mother of Exception Handling Anti-Patterns

    I know this has been discussed before elsewhere - but since I'm cranky about finding it after not-so-few-minutes of looking in some legacy code I'm working on - what follows is NOT an example of proper exception handling: } catch (Exception ex) { AuditLogger.LogError(ex); } This "swallow...
    Posted to Billy McCafferty by Billy McCafferty on 11-30-2007
    Filed under: Filed under:
  • Back to Basics: XOR

    Conditionals are a common spot for the unintended creation of un-maintainable and un-readable code. To mitigate complicated conditionals, refactoring with Decompose Conditional always helps in conveying what you're trying to do. In other times, it's simply a matter of making the conditional logic...
    Posted to Billy McCafferty by Billy McCafferty on 11-24-2007
    Filed under: Filed under:
  • Casting options in C#

    What is the best way to cast from one type to another in C#? This question came up at work last week while I was looking through some older code. The code in question was using the C style casting syntax. I have started to use the "as" style cast more often and rewrote it. Then I decided to...
    Posted to Alan Northam by anortham on 10-07-2007
    Filed under: Filed under: , ,
  • Jon Skeet writes a book: "C# in Depth"

    Have you ever been to the microsoft.public.dotnet.languages.csharp newsgroup? If you have been there for more than a few moments you must have noticed an individual answering even the toughest C# questions like crazy, Jon Skeet . Jon is a C# MVP and maintains a blog and a collection of very interesting...
    Posted to Marcin Hoppe by Marcin Hoppe on 09-20-2007
    Filed under: Filed under:
  • Design Considerations: StructureMap Configuration and Plugin Keys

    I started playing with StructureMap recently. I am struggling with how to design my code's interaction with StructureMap when it comes to the configuration and use of plugin keys. If you have any insights or experience with this, please let me know! 1. Configuration via StructureMap.config Pros : * Separation...
    Posted to Lou Haskett by Louis Haskett on 06-26-2007
    Filed under: Filed under: , , , ,
  • How-To: "Cast" between List<T>'s

    Problem : If you've ever tried to cast been list generics, you know that you can't. Example : 1. You have two classes Shape and Square, where Square inherits from Shape. 2. You have two generic lists, List<Shape> and List<Square>. 3. List<Square> does not inherit from List<Shape>...
    Posted to Lou Haskett by Louis Haskett on 06-13-2007
    Filed under: Filed under: , , ,
  • How to keep List<T> sorted?

    The Problem Recently I ran into a need to keep a list of integers sorted in ascending order. The list was used as an internal representation of a set, so I didn't have to create a new class implementing IList<T> or anything similar. The whole issue was to implement adding new elements properly...
    Posted to Marcin Hoppe by Marcin Hoppe on 05-15-2007
    Filed under: Filed under:
  • Using Equals/GetHashCode Effectively

    [Updated March 10, 2009: Important!! While the original content shown below is usable in most cases, there are scenarios wherein it breaks down. The results of GetHashCode should not also be used as the means for expressing object equality. Accordingly, this, and other issues have been resolved and may...
    Posted to Billy McCafferty by Billy McCafferty on 04-25-2007
    Filed under: Filed under: ,
  • Persistence Ignorance

    People are talking about Microsoft's Entity framework and how it does not currently allow persistence ignorant domain objects. I've been torn about this issue for a while now . On the one hand, having an O/R mapper that is persistent ignorant essentially means that it has to support XML mapping files...
    Posted to Jeff Perrin - Sexier Than You Are by Jeff Perrin on 03-14-2007
    Filed under: Filed under: , ,
  • Varying a Property's get/set Accessibility

    It is a common occurrence wherein you may want to publicly expose a property's getter but internally restrict the setter. (The last refactoring challenge had a good use for this.) I regularly see people provide a publicly exposed property - with only a getter - and then add an internally available method...
    Posted to Billy McCafferty by Billy McCafferty on 02-15-2007
    Filed under: Filed under:
  • Inject DI Container into Domain Objects with NHibernate

    I've been asked a couple of times how to give a domain object access to a dependency injection (DI) container, such as Castle Windsor, if the domain object is loaded via an ORM, such as NHibernate. There are two apparent ways to do this: 1) you can manually give the domain object access to the DI via...
    Posted to Billy McCafferty by Billy McCafferty on 02-05-2007
    Filed under: Filed under: , ,
  • Refactor It! Challenge 3 - The State of Things

    If you're not familiar with the Refactor It! challenges, please read this post . (Yes, this one is quite a bit overdue.) Now on to challenge 3... Welcome back to another refactoring challenge! This challenge will pit your skills against the very useful State Design Pattern along with writing your own...
    Posted to Billy McCafferty by Billy McCafferty on 12-19-2006
    Filed under: Filed under: , , ,
Page 2 of 4 (53 items) < Previous 1 2 3 4 Next >

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Google Reader or Homepage Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of
Red-Gate Tools For SQL and .NET


SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
NHibernate Profiler
Balsamiq Mockups
JetBrains - ReSharper
Web Sequence Diagrams
Ducksboard<-- NEW Friend!


Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers


Community Server (Commercial Edition)