Tuples In C#, A Useful Example

Background Last year I worked consulted with a company that had an engineer that used tuples in C# and tried to explain to me how they were useful.  To be honest, I never quite saw the value proposition (until today).  I remember he kept saying they were kind of like key value pairs but could go beyond that.  I remember those words but never internalized that. The Example My example is a simple one.  I’m currently working on providing data to an external application that will provide business intelligence (help with session selection) to the Silicon Valley Code Camp web site.  The data I’m providing is every mark of interest and plan to attend for every session ever given at code camp (that’s 220,000 … Continue Reading

Running Visual Studio Web Form Pages By Dragging Them Out of Visual Studio

image.png

I just accidentally discovered that you can run a web page from visual studio by simply dragging the page out of the solution explorer and into a browser.  Who would have known?  I only discovered this because I did that action and thought it would drag the page onto my second monitor so I can edit it.  Another tip which I did know is that you can grab the folder tab of a source page in Visual Studio and drag it to your desktop (second monitor for example) and edit it while stilling seeing the original page. … Continue Reading

Tangible T4 Editor 2.0 Makes Creating T4 Templates Manageable

image.png

Background Having written way too many code generators in my life, I’ve always been attracted to Microsoft’s T4 generation.  For those who don’t know what T4 is, it’s actually a core technology in Visual Studio (all versions) that has been around for a very long time.  It’s used for lots of things including for example generating the C# code that is compiled into your projects with Entity Framework. Over the past 5 years, I’ve tried on several occasions to build my own T4 templates and unfortunately have always given up because the building of T4 templates experience in Visual Studio is just not pleasant. Fast Forward To Tangible’s T4 Editor http://t4-editor.tangible-engineering.com/T4-Editor-Visual-T4-Editing.html Because of … Continue Reading

LINQ tricks for performance (LINQ2SQL Old School)

image.png

I’m working quite a bit on the new Silicon Valley Code Camp site these days and introducing lots of new ways to view sessions.  Much of this code I’ve written over 8 years ago, long before I had so many tricks in my bag. So, one of the things we track is session interest by attendee.  To do that we have two tables, SessionAttendee and Sessions. Doing a simple join and count of the number of SessionAttendee records per session pretty much gives us what we need. Basically, we create a dictionary so we can get all the counts at once so that way, just one sql to the database interestCountsDict = (from data in meta.SessionAttendee where data.Interestlevel == 2 group data by … Continue Reading

Follow

Get every new post delivered to your Inbox

Join other followers: