Browse by Tags

Converting RTF to HTML
28 September 09 11:28 AM | MattManela | 0 Comments   
Have you ever had the desire to convert some RTF text into HTML? Probably not. But if you do, then you are in luck! I recently had the need to do this conversion and after some searching found out a way to do it by enhancing a sample distributed in the Read More...
Filed under: , , , ,
Attachment(s): MarkupConverter.zip
I finally got fed up with Enum.Parse
24 July 09 09:02 AM | MattManela | 3 Comments   
I don’t know why I didn’t do this long ago, but I am done writing this: var val = (SomeEnum)Enum.Parse( typeof (SomeEnum),”someString”); I have typed this too many times and it annoys me.  I wrote a small extension method on the string type to make Read More...
Filed under: ,
My xUnit.net Visual Studio Code Snippets
02 March 09 03:58 PM | MattManela | 1 Comments   
The xUnit .Net codeplex page lists one useful Visual Studio code snippet for creating a Fact. As you can tell I am fairly fond of code snippets so I created a few more which I use when writing xUnit.net facts. These are one line snippets that I find very Read More...
Filed under: , ,
Attachment(s): xUnitSnippets.zip
Inline Regular Expression Options
01 January 09 12:10 PM | MattManela | 1 Comments   
I was using attributes from the System.ComponentModel.DataAnnotations    namespace for model validation.  This namespace includes a few very useful validation attributes such as Required Attribute – Validates the field has a value Range Read More...
Filed under: ,
Model Binder
15 December 08 10:45 PM | MattManela | 0 Comments   
When working with a multi-tier application I often find myself converting from one of the tiers object models to my own similar (but often different) model.  I often write code that would set one by one each property from a web tier object to my Read More...
Filed under: ,
SQL CE 3.5 with LINQ to SQL Revisited
26 September 08 08:26 AM | MattManela | 4 Comments   
A few days ago I made a post about using SQL CE 3.5 with LINQ to SQL .   I described a way to use connection pooling with SQL CE. A gracious blog reader (Mike Brown)  pointed out a way I could make my solution much simpler by using the Read More...
Filed under: , ,
SQL CE 3.5 with LINQ to SQL
09 September 08 02:04 PM | MattManela | 2 Comments   
Using LINQ to SQL with SQL CE 3.5 can be a bit of a challenge.  First off, the LINQ to SQL Visual Studio designer doesn't support SQL CE so you need to run sqlmetal from the command line to create the object model (or write it by hand).  Once Read More...
Filed under: , , ,
CollectionView.DeferRefresh() : My new best friend
28 August 08 02:23 PM | MattManela | 2 Comments   
Well, maybe not best friend but its a nice function.  When working with bound collections in WPF you often end up dealing with a CollectionView .  This is the MSDN documentation description of a CollectionView : You can think of a collection Read More...
Filed under: , ,
Generic Insert and Update for LINQ To SQL
12 August 08 02:46 PM | MattManela | 1 Comments   
Quick code snippet time! The following are generic methods for inserting and updating a detached entity into a database using LINQ to SQL. 1: /// <summary> 2: /// Updates the database with item. 3: /// </summary> 4: /// <typeparam name="T">Type Read More...
Filed under: ,
Foreach is Duck Typed!
22 July 08 10:04 AM | MattManela | 5 Comments   
I thought I know how the foreach construct worked under the covers. I figured the compiler would check if the type being iterated over implement IEnumerable or IEnumerator. And if so it will call MoveNext and Current to loop over the elements. But then Read More...
Filed under: , ,
ArgumentNullException vs ArgumentException
28 May 08 09:17 PM | MattManela | 2 Comments   
Both ArgumentNullException and ArgumentException have a constructor which takes two strings. One is the name of the parameter (or argument) in question and the other is a string describing the exception. The funny/odd/interesting thing about them is that Read More...
Filed under: ,
Intro to LINQ to SQL Optimistic Concurrency
22 May 08 08:40 PM | MattManela | 0 Comments   
After some investigation I feel I have a decent understanding on how LINQ to SQL concurrency works. LINQ to SQL uses optimistic concurrency which means that it never takes an exclusive lock on a table. It caches the information you are working with and Read More...
Filed under: , ,
Closures and Pass by Reference
30 April 08 07:15 PM | MattManela | 5 Comments   
What do you think the following code will do? Compile time error Run time error Work fine 1: static void Main( string [] args) 2: { 3: int x = 10; 4: int y = 5; 5: Swap( ref x, ref y); 6: } 7: 8: 9: static void Swap( ref int x, ref int y) 10: { 11: int Read More...
Filed under: ,
Covariance and Contravariance
30 March 08 04:21 PM | MattManela | 0 Comments   
I just finished reading the series of ten blog posts by Eric Lippert about covariance and contravariance . These topics were new to me but after reading this blog series it all made sense. It finally explained to me why some things which I thought I should Read More...
Filed under:
Lazy Prime Number Sieve in C#
16 March 08 11:28 PM | MattManela | 3 Comments   
In my last post I talked about a Stream class for creating efficient lazy lists in C#. In addition, I showed several classic functional methods I ported to C# to be used on the lazy lists. As I mentioned in that post, I will now talk about an example Read More...
Filed under: , ,
More Posts Next page »
Page view tracker