using System;
using System.Collections.Generic;

public class MyClass
{
static void DoStuff<T,S>(T t,S s) where T:MyClass
{
Console.WriteLine("T:{0}",t);
Console.WriteLine("S:{0}",s);
}

public static void RunSnippet()
{

DoStuff<MyClass,string>(new MyClass(),"ffff");
}

#region Helper methods

public static void Main()
{
try
{
RunSnippet();
}
catch (Exception e)
{
string error = string.Format("---\nThe following error occurred while executing the snippet:\n{0}\n---", e.ToString());
Console.WriteLine(error);
}
finally
{
Console.Write("Press any key to continue...");
Console.ReadKey();
}
}

private static void WL(object text, params object[] args)
{
Console.WriteLine(text.ToString(), args);
}

private static void RL()
{
Console.ReadLine();
}

private static void Break()
{
System.Diagnostics.Debugger.Break();
}

#endregion
}

posted on 2015-11-17 10:53  jinweijie0527  阅读(147)  评论(0编辑  收藏  举报