CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets matching tags of Extension Method
C#
namespace DataFieldMappingConsoleSample
{
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Data.SqlClient;
    using System.Linq;
 
    class Program
    {
61 Views
no comments
 
C#
namespace DataFieldMappingConsoleSample
{
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Diagnostics;
    using System.Linq;
    using System.Reflection;
 
    [AttributeUsage(AttributeTargets.Property)]
51 Views
no comments
 
C#
// usage
class Person {
    ICollection<Address> Addresses { get; set; }
}
 
person.Ensure(p => p.Addresses);
 
// implementation
public static class Crap
{
by John Nelson   October 12, 2010 @ 10:36am
158 Views
1 comments
 
C#
public static PerpetualEnumerator<T> GetPerpetualEnumerator<T>(this IEnumerable<T> items)
{
    return new PerpetualEnumerator<T>(items);
}
314 Views
no comments
 
C#
namespace NUnit.Framework
{
    public static class AssertionHelpers
    {
        public static void WithMessage(this Exception ex,string expectedMessage)
        {
            Assert.AreEqual(ex.Message, expectedMessage);           
        }
    }
}
by DrRandom   December 29, 2009 @ 12:09pm
446 Views
no comments
 
C#
// Extension method for retrieving a page from a PageReference
// For example:
// PageData parent = CurrentPage.ParentLink.GetPage()
public static PageData GetPage(this PageReference link)
{
    if (link==PageReference.EmptyReference)
        return null;
 
    return DataFactory.Instance.GetPage(link);
}
by Ted Nyberg   December 08, 2009 @ 8:02am
219 Views
1 comments
 
C#
using System;
using System.Linq;
 
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Person[] people = new Person[] {
404 Views
no comments
 
C#
/// <summary>
/// Convert a choice number into a reader-friendly string.
/// </summary>
/// <param name="choiceNumber">
/// The choice number.  <c>1</c>-<c>254</c> represent a preferential ordering,
/// and a value of <c>255</c> represents a "Pass" choice.
/// </param>
/// <returns>A string such as <c>"1st Choice"</c> or <c>"Pass"</c>.</returns>
/// <exception cref="ArgumentOutOfRangeException">
/// When a value of <c>0</c> is specified.
by Jeff Handley   August 15, 2009 @ 10:58pm
263 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate