Shawn Weisfeld

I find when I talk to myself nobody listens. - Shawn Weisfeld
posts - 365, comments - 174, trackbacks - 34

My Links

News


Shawn Weisfeld's Facebook profile

The views expressed in this blog are mine and mine alone, not that of my employer, Microsoft, or anyone else’s. No warrantee is given for the quality of any material on this site.

Archives

Post Categories

C#

Using C# 4.0 and dynamic to parse JSON

  UPDATE: take a look at http://json.codeplex.com/ before you try and roll your own, it supports dynamic now...   I recently had to get a JSON feed from the web and traverse it. Like any good developer I started off with a Bing search and stumbled across a few posts.   The first by Nikhil Kothari looked interesting but his implementation did way too much, all I needed to do was read a JSON file, did I really need all that code. http://www.nikhilk.net/CSharp-Dynamic-Programming-JSON.aspx   The second post I saw by Alex Ghiondea again looked interesting but relied on a library from codeplex (JSON.NET, http://json.codeplex.com/) and again...

posted @ Sunday, August 22, 2010 8:03 AM | Feedback (36) | Filed Under [ C# ]

Developer: Utilizing .NET Generics to write better code by Shawn Weisfeld @ UT Dallas .NET UG on 02/27/2010

This Saturday (2/27) I will be giving my .NET Generics talk for the UT Dallas .NET UG in Richardson TX. If you are in the area please check it out (http://www.usergroupsupportservices.com/UGEventView.ugss?EventID=9160). If you cannot make it but are interested in seeing the talk, you can watch it online. Abstract: Generics let you tailor a method, class, structure, or interface to the precise data type it acts upon. In this session we will discuss what capabilities Generics provide to you the developer and how to use them in collections, and with delegates. We will also talk about creating your own generic classes and...

posted @ Wednesday, February 24, 2010 7:45 PM | Feedback (0) | Filed Under [ .NET C# ]

Shawn @ Dallas Dev Cares 2009/12/11

Thanks to all that attended my 3 talks at the Dallas Dev Cares UG yesterday and thanks Ken Byrd from TekFocus for hosting the meeting. As promised here is the download of the PowerPoint and code bits. I also included links to recordings of 2 of the 3 talks. Download Presentations Here Recording of ASP.NET Dynamic Data:   Recording of Developer of <T> Generics talk:

posted @ Saturday, December 12, 2009 10:10 AM | Feedback (0) | Filed Under [ ASP.NET Dynamic Data C# INETA LIVE ]

Dallas DevCares – Dec 11 2009: C# Generics, ASP.NET Dynamic Data & VS.NET Tips and Tricks

By popular request on Dec 11 I will be giving 2 of my most popular talks on C# Generics and ASP.NET Dynamic Data. Then as a bonus just for the DevCares Community I will put together some of my favorite VS.NET Tips and Tricks. You can attend online or in person. Get all the details on there website at http://www.dallasdevcares.com/

posted @ Tuesday, November 10, 2009 6:43 AM | Feedback (1) | Filed Under [ ASP.NET Dynamic Data C# Event ]

Tulsa Tech Fest 2009

Thanks to everyone that attended my .NET Generics Talk at the Tulsa Tech Fest today. You can download the code and PowerPoint here, and the recording will be posted to this blog and INETA Live shortly. Developer<T>: Utilizing .NET Generics to write better code Shawn Weisfeld Generics let you tailor a method, class, structure, or interface to the precise data type it acts upon. In this session we will discuss what capabilities Generics provide to you the developer and how to use them in collections, and with delegates. We will also talk about creating your own generic classes and methods....

posted @ Friday, November 6, 2009 9:37 AM | Feedback (0) | Filed Under [ C# INETA LIVE ]

Call a Multiple-Rowset stored procedure with LINQ to SQL and without the designer

Multiple-Rowset allows you to return more than one select from your stored procedure. For example in the stored procedure below you can see we have 2 select statements. As we learned in my last 2 posts it is possible to use LINQ to SQL without the designer. A simple select with LINQ to SQL and without the designer (http://drowningintechnicaldebt.com/blogs/shawnweisfeld/archive/2009/07/11/a-simple-select-with-linq-to-sql-and-without-the-designer.aspx) Call a stored procedure with LINQ to SQL and without the designer (http://drowningintechnicaldebt.com/blogs/shawnweisfeld/archive/2009/07/11/call-a-stored-procedure-with-linq-to-sql-and-without-the-designer.aspx) To utilize Multiple-Rowset we just need to tweak our function in our data context...

posted @ Sunday, July 12, 2009 4:45 PM | Feedback (0) | Filed Under [ C# LINQ to SQL ]

Call a stored procedure with LINQ to SQL and without the designer

In my last post I talked about how to do a simple select with LINQ to SQL without the designer (http://drowningintechnicaldebt.com/blogs/shawnweisfeld/archive/2009/07/11/a-simple-select-with-linq-to-sql-and-without-the-designer.aspx). This is all well and good, but what if you need to use a stored procedure. Like this one. . . . The first step is to add to our data context a method that maps to our stored procedure. You can see we start off with a Function attribute that tells LINQ to SQL what stored procedure to use. Additionally we decorate the parameters on our method with Parameter attributes that tell LINQ to SQL how to...

posted @ Saturday, July 11, 2009 10:15 PM | Feedback (3) | Filed Under [ C# LINQ to SQL ]

A simple select with LINQ to SQL and without the designer

Many folks poo-poo LINQ to SQL because they don’t like designers. On the other hand some developers, myself included, like knowing how things work behind the scenes, for those edge case moments when the designer cannot do something. The most common business case for this is if you want to LINQ to SQL-afy an existing suite of objects. Well using the designers is NOT a requirement of LINQ to SQL. Lets say for example you had an existing customer table and customer business object: Lets see if we can get LINQ to SQL to...

posted @ Saturday, July 11, 2009 9:57 PM | Feedback (2) | Filed Under [ C# LINQ to SQL ]

Extension Method to Resize an Image

I wrote this for an INETA project that I have been working on, but thought it would be great to share with everyone. We had a need to take an image and change its size. Below is an implementation of a Resize Extension Method on the .NET Image object.  I borrowed some ideas from this post by Mark McDonnell (http://weblogs.asp.net/markmcdonnell/archive/2008/03/09/resize-image-before-uploading-to-server.aspx) 1: using System; 2: using System.Collections.Generic; 3: using System.Linq; 4: using System.Text; 5: using System.Drawing; 6: using System.Drawing.Drawing2D; 7: ...

posted @ Sunday, June 28, 2009 6:52 PM | Feedback (3) | Filed Under [ C# Images ]

Property Causing a Stack Dump

Got a call today, someone was getting a stack dump every time they tried to assign a value to a property. Here is a screen print of the problem they were having. can you spot the problem? If you said that the property is calling itself you get a gold star.  What was happening is that every time we tried to set the Name property, it calls the Name property to set it, and that called the Name property, and that called the Name property, over and over again, till .NET stack dumped. We are missing a...

posted @ Tuesday, June 16, 2009 12:26 AM | Feedback (0) | Filed Under [ .NET C# ]

Full C# Archive

Powered by: