1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 using System; using System.IO;   namespace FileHandling { public class FileHandling { static void Main(string[] Args) { StreamReader lStrReader; [...]

read full post »

Reading a text file line by line

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 using System; using System.IO;   namespace FileHandling { public class FileHandling { static void Main(string[] Args) { FileStream lFStream; StreamReader lStrReader; [...]

read full post »

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 using System; using System.Text.RegularExpressions;   namespace RegexTest { public class RegexTest {   static void Main() { string lText = "Kevin David Mitnick is a computer " + "security consultant [...]

read full post »

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 using System; using System.Text.RegularExpressions;   namespace RegexTest { public class RegexTest {   static void Main() { string lText = "Kevin David Mitnick is [...]

read full post »

Aborting a thread

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 using System; using System.Threading;   namespace Threading { public class Program {   protected static void threadFunction() { Console.WriteLine("Inside the thread. "); while (true) { [...]

read full post »

Stopping a thread

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 using System; using System.Threading;   namespace Threading { public class Program { static bool mStopThread = false;   protected static void threadFunction() { [...]

read full post »

Creating a thread

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 using System; using System.Threading;   namespace Threading { public class Program {   protected static void threadFunction() { int lCounter;   for (lCounter = 0; lCounter < [...]

read full post »

Get local IP addresses

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 using System; using System.Collections.Generic; using System.Text; using System.Net;   namespace HostName { public class Program { static void Main(string[] args) { String lComputerName = Dns.GetHostName(); IPAddress[] localIPs = Dns.GetHostAddresses(lComputerName);   if (localIPs.Length > 0) foreach [...]

read full post »

Get local host name

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17   using System; using System.Collections.Generic; using System.Text; using System.Net;   namespace HostName { public class Program { static void Main(string[] args) { string lHostName = Dns.GetHostName(); Console.WriteLine("Host name : " + lHostName); } } }

read full post »

Get IP address from host name

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17   using System; using System.Text; using System.Net;   namespace HostName2IP { class Program { static void Main(string[] args) { IPHostEntry lHost = Dns.GetHostByName("www.google.com"); IPAddress lIPAddr = lHost.AddressList[0]; Console.WriteLine(lIPAddr); } } }

read full post »

older posts »