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 compare
C#
public static void Copy(string sourceDirName, string destDirName, bool excludeSubdirectories)
{
    // Style #1: fluent
    Guard.MethodArgument("sourceDirName").IsNotNullOrEmpty(sourceDirName);
    Guard.MethodArgument("destDirName").IsNotNullOrEmpty(destDirName, "The destination directory is required!");
 
    // Style #2: lambdas and expressions
    Guard.Argument.IsNotNullOrWhiteSpace(()=>sourceDirName);
    Guard.Argument.IsNotNullOrWhiteSpace(()=>destDirName, "The destination directory is required!");
by Al Gonzalez   May 24, 2010 @ 8:58pm
84 Views
1 comments
 
C#
/// <summary>
/// Implements a projection strategy that select an "identity" property from an object 
/// and uses the default comparer to implement IEqualityComparer<typeparamref name="T"/>
/// </summary>
/// <typeparam name="T">Type of object to extract identity from</typeparam>
/// <typeparam name="TRet">Type of the extracted identity value</typeparam>
public class IdentityProjectionEqualityComparer<T, TRet> : IEqualityComparer<T> where TRet : IComparable<TRet>
{
    private readonly Func<T, TRet> _projector;
    private readonly IEqualityComparer<TRet> _comparer;
by Marc Brooks   May 18, 2010 @ 2:26pm
176 Views
2 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