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 for: tarasn
C#
public class  Email : IHideObjectMembers
{
    private SmtpClient _client;
    public MailMessage Message { get; set; }
 
    private Email()
    {
        Message = new MailMessage() { IsBodyHtml = true };
        _client = new SmtpClient();
    }
by tarasn   April 12, 2010 @ 12:16pm
Tags: fluent
137 Views
no comments
 
C#
public class PerformanceTester
{
    public TimeSpan TotalTime { get; private set; }
    public TimeSpan AverageTime { get; private set; }
    public TimeSpan MinTime { get; private set; }
    public TimeSpan MaxTime { get; private set; }
    public Action Action { get; set; }
 
    public PerformanceTester(Action action)
    {
by tarasn   April 12, 2010 @ 12:14pm
219 Views
no comments
 
C#
/* Usage 
string test1 = StripTags("<p>George</p><b>W</b><i>Bush</i>", new string[]{"i","b"});
string test2 = StripTags("<p>George <img src='someimage.png' onmouseover='someFunction()'>W <i>Bush</i></p>", new string[]{"p"});
string test3 = StripTags("<a href='http://www.dijksterhuis.org'>Martijn <b>Dijksterhuis</b></a>", new string[]{"a"});

*/
 
 
 
by tarasn   March 31, 2010 @ 9:21am
Tags: php html
219 Views
no comments
 
C#
// usage:
// var constructor = GetConstructor<Foo>();
// IFoo foo = constructor();
 
 
private static Func<T> GetConstructor<T>() where T : class, new()
{
    ConstructorInfo constructorInfo = typeof(T).GetConstructor(new Type[0]);
    return Expression.Lambda<Func<T>>(Expression.New(constructorInfo))
                .Compile();
by tarasn   March 26, 2010 @ 12:21pm
Tags: lambda
406 Views
no comments
 
C#
/// <summary>
/// Return empty enumerator when passed enumerator equals to null
/// </summary>
/// <param name="source">The source.</param>
/// <returns></returns>
public static IEnumerable<T> EmptyIfNull<T>(this IEnumerable<T> source) 
{
    return source ?? Enumerable.Empty<T>();
}
by tarasn   January 19, 2010 @ 11:21pm
167 Views
no comments
 
<Node>
   <ID>123</ID>
   <Name>ABC</Name>
</Node>
<Node1>
   <ID>124</ID>
   <Name>DEF</Name>
</Node1>
 
by tarasn   January 14, 2010 @ 2:37pm
228 Views
no comments
 
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.InterceptionExtension;
using System.Collections;
 
namespace ConsoleApplicationUnityIntercep
by tarasn   January 11, 2010 @ 12:17am
515 Views
no comments
 
XML
NA
by tarasn   January 10, 2010 @ 11:36pm
255 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