Sign in
Matthew Manela's Blog
Translate This Page
Translate this page
Powered by
Microsoft® Translator
Tags
.NET
ADO.NET
Applications
ARR
ASP .NET
ASP .NET MVC
ASP.NET
AutoMapper
C#
Chutzpah
CLR
Codeplex
Comic
Dependency Injection
DiffPlex
Downloads
F#
FastSharp
Functional Programming
Funny
Games
Git
github
Haskell
HTML
Internet Explorer
J
JavaScript
JQuery
LINQ
Localization
Mercurial
Moq
MSDN Code Gallery
NHibernate
NuGet
Open Source
OpenWithTest
Parsing
PC
Personal
Powershell
pro
Programming
Project Euler
Random Thoughts
Regular Expression
RTF
SignalR
Silverlight
Snippet Designer
Snippets
Software Development
SQL CE
structuremap
testing
Tools
TypeScript
Ubuntu
Uncategorized
Visual Basic
Visual Studio
Visual Studio 2012
Visual Studio Gallery
VS SDK
WHAT!
Windows
Windows Phone
WPF
XAML
Browse by Tags
MSDN Blogs
>
Matthew Manela's Blog
>
All Tags
>
c#
Tagged Content List
Blog Post:
Converting between RTF to HTML and HTML to RTF
Matthew Manela
A while back I posted Converting RTF to HTML which showed how to convert RTF text into HTML markup using the WPF RichTextBox control. Since then I have noticed many posts on forums asking for a free and easy way … Continue reading →
on
27 Apr 2011
Blog Post:
FastSharp 2.0
Matthew Manela
I just released a new version of my FastSharp program. Download it or View the source code This release contains some notable enhancements: Support for multiple languages C# Visual Basic F# Persistence of your current code language and snippet. This allows you to close FastSharp and start...
on
8 Aug 2010
Blog Post:
Useful Moq Extension Method
Matthew Manela
I have been working with ASP .NET MVC and I use the Moq mocking library to help test the code I write. Often in ASP MVC anonymous objects are passed around as function arguments. This is especially common in calls to RouteUrl. Since I want to be able to test this and verify that it is called correctly...
on
24 Nov 2009
Blog Post:
Converting RTF to HTML
Matthew Manela
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 MSDN library. The sample is called: XAML to HTML...
on
28 Sep 2009
Blog Post:
I finally got fed up with Enum.Parse
Matthew Manela
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 this better: public static...
on
24 Jul 2009
Blog Post:
My xUnit.net Visual Studio Code Snippets
Matthew Manela
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 convenient when writing my assertions. Below...
on
2 Mar 2009
Blog Post:
Inline Regular Expression Options
Matthew Manela
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 Attribute – Validates the field is within a given...
on
1 Jan 2009
Blog Post:
Model Binder
Matthew Manela
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 object. In order to make this easier I wrote...
on
16 Dec 2008
Blog Post:
SQL CE 3.5 with LINQ to SQL Revisited
Matthew Manela
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 [ ThreadStatic ] attribute. I never heard of this attribute but it is...
on
26 Sep 2008
Blog Post:
SQL CE 3.5 with LINQ to SQL
Matthew Manela
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 you get past this point then you can use LINQ to SQL the same...
on
9 Sep 2008
Blog Post:
CollectionView.DeferRefresh() : My new best friend
Matthew Manela
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 view as a layer on top of a binding source collection...
on
28 Aug 2008
Blog Post:
Generic Insert and Update for LINQ To SQL
Matthew Manela
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 of the item<...
on
12 Aug 2008
Blog Post:
Foreach is Duck Typed!
Matthew Manela
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 I read this: http://blogs.msdn.com/kcwalina/archive...
on
22 Jul 2008
Blog Post:
ArgumentNullException vs ArgumentException
Matthew Manela
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 one has the opposite order of arguments. For ArgumentException...
on
29 May 2008
Blog Post:
Intro to LINQ to SQL Optimistic Concurrency
Matthew Manela
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 then (by default) when you submit changes verifies...
on
22 May 2008
Blog Post:
Closures and Pass by Reference
Matthew Manela
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 temp = x; 12: x = y; 13: y = temp; 14: Func<...
on
30 Apr 2008
Blog Post:
Covariance and Contravariance
Matthew Manela
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 be able to do does not work in C#. One example...
on
30 Mar 2008
Blog Post:
Lazy Prime Number Sieve in C#
Matthew Manela
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 I included in the source code for the lazy list class...
on
17 Mar 2008
Blog Post:
Digging deeper into C# Lazy Lists
Matthew Manela
One of the most interesting aspects of the Haskell language is the fact that features lazy evaluation. My interest in lazy evaluation led me to a post on Wes Dyers blog about lazy lists in C#. In his blog post he talks describes how to create a lazy list class in C# and demonstrates some classic lazy...
on
15 Mar 2008
Blog Post:
Useful LINQ Method- GetMemberTypeChain
Matthew Manela
Recently, I have been working on a custom LINQ provider in C#. In a later post (when I have more time to write) I will go in depth into what I am worked on and what have I learned about writing a LINQ provider. But for now I will present a simple function that simplified part of my work. It is called...
on
7 Mar 2008
Blog Post:
Understanding Variable Capturing in C#
Matthew Manela
With the addition of anonymous delegates in C# 2.0 and with lambda expressions in C# 3.0 you might have been hearing a lot about variable capturing. This is the mechanism in which the delegate/lambda which was defined inline is able to hold on to any variables within its lexical scope. For example in...
on
1 Mar 2008
Blog Post:
FastSharp - Write it, Execute it
Matthew Manela
UPDATE: New version on FastSharp that includes a Windows 7 Gadget! Learn more here. Last year I wrote this program which I named FastSharp. It is a text editor which lets you compile and run C# code that would normally exist inside a method. The inspiration for this came from getting tired of opening...
on
11 Feb 2008
Blog Post:
Who would have thunk it?
Matthew Manela
I recently read this article about Lazy Computation in C# . What the article discusses is creating lazy evaluation in C#. Lazy evaluation is a key feature of functional languages like Haskell but is not common in imperative languages. It is used in Haskell because it implements parameter passing on a...
on
19 Dec 2007
Blog Post:
Did you know.... Generic Methods
Matthew Manela
Did you know that you can call a generic method with out supplying the type argument. The C# compiler will fill in the type parameter for you at compile time since the language is strongly typed. static void MyMethod<S>(S myParam) { Console.WriteLine( typeof (S).ToString()); Console...
on
16 Dec 2007
Blog Post:
Lambda Expressions are more fun in Visual Basic .NET
Matthew Manela
I love C# and I would never want to do anything to make it seem any less amazing but I have to give credit where credit is due ... to Visual Basic .NET. Yes, I said it. Both languages have been adding features inspired by the functional and dynamic programing world. However, VB .NET has went a few steps...
on
7 Dec 2007
Page 1 of 2 (31 items)
1
2