Tag Archive - C#

ByATool.com gets a shiny new tool!

31 March 2010 by Andre, No Comments

A while back, we put up an offer to write for our blog.  Only one has risen to the top as someone having both the technical know-how and the razor sharp wit required to write on a site such as this. ByATool.com Readers… Amy. Amy… ByATool.com Readers. Amy is a magnificent geek and almost 10 [...]

Tags: , , ,

Data Annotations, MVC, and Why You Might Like Them

16 December 2009 by Sean, No Comments

So if you were like me before I knew what Data Annotations were, you most likely would be thinking, “What are Data Annotations?”. Well I’m glad I can read your mind and therefore I am glad you asked. Now the fun part about this post is that I might have to admit I was wrong. [...]

Random Add-On – Automapper

1 December 2009 by Sean, No Comments

So if you’ve bothered reading my posts in the past, and don’t worry cause I haven’t, you might have seen me express my rule about not wanting to use third party stuff. Well things change. Actually they don’t, as I’m not bending the rule because I’m becoming a better person, just more lazy. This is [...]

Tags: ,

State List in Dictionary Form

1 December 2009 by Sean, No Comments

Tired of having to look this up from time to time, so I’m putting this here for my own use. If you get something out of it, good for you. In the end, I really don’t care. public Dictionary GetAllStates() { if(_stateList == null) { _stateList = new Dictionary(); _stateList.Add(“Alabama”,”AL”); _stateList.Add(“Alaska”,”AK”); _stateList.Add(“American Samoa”,”AS”); _stateList.Add(“Arizona”,”AZ”); _stateList.Add(“Arkanas”,”AR”); [...]

Tags: ,

Entity Framework: Possible Lazy Loading Solution

19 June 2009 by Sean, No Comments

So been a while since I posted last, and I’m sure everyone has been worried. Turns out that I’ve been banging my head against the wall named MVC. And man I have a slew of new posts back logged for when I have more time. However, due to the new project I’ve been working one, [...]

By Reference in C# and How to Get Schooled By It

1 December 2008 by Sean, No Comments

WARNING: If you understand The concept of By Reference, skip the first part of this post: So you have an object, huh? Ok well what does that mean? Basically there is a stack and a heap. When you declare an object, space is made on the stack, basically it’s a placeholder saying that there will [...]

C#, Var, and Objec- Propert- I have no idea what the term is

20 November 2008 by Sean, No Comments

So I caugh this the other day and I’m not really sure it’s useful but it got me thinking… Say you have a string and you want to create what ReSharper calls a “implicitly typed local variable declaration”, or as most people know it as “var”, and intialize it with a created value: String someThing [...]

Linq Extension Methods Versus Linq Query Language… DEATHMATCH

13 November 2008 by Sean, No Comments

Today I was writing out an example of why the extension methods are for the most part better to use than the querying language. Go figure I would find a case where that’s not entirely true. Say you are using these three funcs: Func<User, String> userName = user => user.UserName; Func<User, Boolean> userIDOverTen = user [...]

Tags: , , , ,

Static Abstract … should I bother?

17 October 2008 by Sean, No Comments

So it came up recently that someone was bummed that you can’t create a static abstract method. Now conceptually, this is blocked by C# but I came up with this “work around”… And I have no idea if I would ever use it. This was more of a “Do it because I can” rather than [...]

Tags: ,

The Switch Remover: Convert Switch Statements to Dictionaries

17 October 2008 by Sean, No Comments

Folks, what if I told you that Switch is a thing of the past? What if I told you I had a way to reduce code in certain areas so that you don’t have that messy Switch logic? What would you pay for that? Would you pay $19.95? Not convinced? Well take this: switch(someDropDownList.SelectedValue) { [...]