Saturday, January 23, 2010

Smelser.NET | Is my code Fluent?

public static class FluentCommentExtensions
{
    public static NonFluentComment By(this NonFluentComment instance, string commentorsName)
    {
        instance.CommentedBy = commentorsName;
        return instance;
    }

    public static NonFluentComment Says(this NonFluentComment instance, string comment)
    {
        instance.Comment = comment;
        return instance;
    }

    public static NonFluentComment RatedYou(this NonFluentComment instance, ushort rating)
    {
        instance.Rating = rating;
        return instance;
    }

    public static NonFluentComment CanBeContactedAt(this NonFluentComment instance, string commentorsEmail)
    {
        instance.CommentorsEmail = commentorsEmail;
        return instance;
    }
}

Posted via web from solution revolution

No comments: