public void testClipBoardContentsAreChangedWhenQueueIsEmptyContentProvided() {
assertTrue(queue.isClipBoardContentsChanged("New Content"));
}
Tag Archive for c
Sample C# code new
paramref Tag C Sharp XML Documentation Comment
/// text for class TestClass
public class TestClass
{
/// <summary>DoWork is a method in the TestClass class.
/// The <paramref name="Int1"/> parameter takes a number.
/// </summary>
public static void DoWork(int Int1)
{
}
/// text for Main
static void Main()
{
}
}
include Tag C Sharp XML Documentation comment
// compile with: /doc:DocFileName.xml
/// <include file='xml_include_tag.doc' path='MyDocs/MyMembers[@name="test"]/*' />
class Test
{
static void Main()
{
}
}
/// <include file='xml_include_tag.doc' path='MyDocs/MyMembers[@name="test2"]/*' />
class Test2
{
public void Test()
{
}
}
exception tag C Sharp XML Documentation
// compile with: /doc:DocFileName.xml
/// comment for class
public class EClass : System.Exception
{
// class definition...
}
/// comment for class
class TestClass
{
/// <exception cref="System.Exception">Thrown when...</exception>
public void DoSomething()
{
try
{
}
catch (EClass)
{
}
}
}
example tag XML C Sharp Documentation comment
// compile with: /doc:DocFileName.xml
/// text for class TestClass
public class TestClass
{
/// <summary>
/// The GetZero method.
/// </summary>
/// <example> This sample shows how to call the GetZero method.
/// <code>
/// class TestClass
/// {
/// static int Main()
/// {
/// return GetZero();
/// }
/// }
/// </code>
/// </example>
public static int GetZero()
{
return 0;
}
/// text for Main
static void Main()
{
}
}
Playing With Extension Methods
using System;
namespace ExtensionMethodTest
{
static class Program
{
public delegate void MyDelegate();
static void Main(string[] args)
{
5.Times(delegate()
{
Console.WriteLine("Hello World");
});
Console.Read();
}
public static void Times(this int count, MyDelegate del)
{
for (int i = 0; i < count; i++)
{
del();
}
}
}
}
Generic Control to Head of Page
HtmlGenericControl si = new HtmlGenericControl();
si.TagName = "script";
si.Attributes.Add("type", "text/javascript");
si.Attributes.Add("language", "JavaScript");
si.Attributes.Add("src", ResolveClientUrl("~/scripts/global.js"));
The famous InvSqrt()
float InvSqrt (float x)
{
float xhalf = 0.5F * x;
int i = * (int *) &x;
i = 0x5F3759DF - (i >> 1);
x = * (float *) &i;
x = x * (1.5F - xhalf * x * x);
return x;
}
Crazy C++ Code
char *s = "DEHLORW";
char *d = "2133464530";
for(i=0; d[i]; i++)
cout << s[d[i]-'0'];
///////////////////////////
i = 1<<1;
i |= 1;
cout << (i<<2) << ":" << (i>>2) << (i==2);
/////////////
x = 0;
cout << (x==0) << (x=0) << (0);
////////////////////////////
class c{
c(int i=0);
public: int a;
};
c::c(int i): a(i) {}