Skip to content

Instantly share code, notes, and snippets.

View schourode's full-sized avatar

Jørn Schou Sandager schourode

  • Copenhagen, Denmark
View GitHub Profile
@schourode
schourode / DisplayNameHelper.cs
Created July 22, 2011 08:14 — forked from dalager/DisplayNameHelper.cs
GetDisplayNameFor<MyType>(x=>x.MyProperty);
public class DisplayNameHelper
{
/// <summary>
/// Get the DataAnnotation attributed DisplayName attribute value.
/// </summary>
/// <example>
/// GetDisplayNameFor&lt;VagtTyper&gt;(x =&gt; x.Doegnvagt) ==&gt; "Døgnvagt"
/// </example>
/// <typeparam name="TSource">The type you wish to work on</typeparam>
/// <typeparam name="TProp">The type of the property</typeparam>