Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts

Tuesday, August 25, 2009

C Sharp

Web.cs
--------
using System;
class webclass
{ public static void Main ()
{
Console.WriteLine("Content_Type :text/html|\n");
Console.WriteLine("First web program ");
}
}

After compiling this web.exe file will be generated .Copy this file into apache\cgi-bin named folder.


Then create a html file

web1.html
----------






<html>
<form action =http://127.0.0.1/cgi-bin/web.exe>
<input type=submit value=Display>
</form>
</html>


then after starting apache

cmd>apache (command to start apache web server)

Then in browser type this hht://127.0.0.1/web1.html and press enter your first C# program got executed.


Thread synchronization
----------------------

Thread synchronization is attained by lock .In common language Runtime (CLR) there are three different types Thread synchronization .

Inter Lock class, Monitor class, Lock statement

In Inter lock class there are there are two threads Increment and Decrement

Interlocked.Increment( )