Archive for February 2010

Free ebook - Beginning Visual Basic 2010

What better way to get started with Visual Basic than with this essential Wrox beginner’s guide?Beginning Microsoft Visual Basic 2010 not only shows you how to write Windows applications, Web applications with ASP.NET, and Windows mobile and embedded

Free ebook - Beginning Visual Basic 2010

What better way to get started with Visual Basic than with this essential Wrox beginner’s guide?Beginning Microsoft Visual Basic 2010 not only shows you how to write Windows applications, Web applications with ASP.NET, and Windows mobile and embedded

Free ebook - Beginning Visual Basic 2010

What better way to get started with Visual Basic than with this essential Wrox beginner’s guide?Beginning Microsoft Visual Basic 2010 not only shows you how to write Windows applications, Web applications with ASP.NET, and Windows mobile and embedded

Free ebook - SAMS C# 4.0 How-To

Need fast, robust, efficient code solutions for Microsoft C# 4.0? This book delivers exactly what you’re looking for. You’ll find more than 200 solutions, best-practice techniques, and tested code samples for everything from classes to exceptions, networking

Free ebook - SAMS C# 4.0 How-To

Need fast, robust, efficient code solutions for Microsoft C# 4.0? This book delivers exactly what you’re looking for. You’ll find more than 200 solutions, best-practice techniques, and tested code samples for everything from classes to exceptions, networking

Free ebook - SAMS C# 4.0 How-To

Need fast, robust, efficient code solutions for Microsoft C# 4.0? This book delivers exactly what you’re looking for. You’ll find more than 200 solutions, best-practice techniques, and tested code samples for everything from classes to exceptions, networking

Free ebook - CLR via C# 3rd Edition

Dig deep and master the intricacies of the common language runtime (CLR) and the .NET Framework 4.0. Written by a highly regarded programming expert and consultant to the Microsoft(R) .NET team, this guide is ideal for developers building any kind of

Free ebook - CLR via C# 3rd Edition

Dig deep and master the intricacies of the common language runtime (CLR) and the .NET Framework 4.0. Written by a highly regarded programming expert and consultant to the Microsoft(R) .NET team, this guide is ideal for developers building any kind of

Free ebook - CLR via C# 3rd Edition

Dig deep and master the intricacies of the common language runtime (CLR) and the .NET Framework 4.0. Written by a highly regarded programming expert and consultant to the Microsoft(R) .NET team, this guide is ideal for developers building any kind of

.NET 4 String Function to Check for Empty Strings

Question is...How to Check an Empty Strings or not in ASP.NET 4.0?How many times have you written code similar to this?string firstName = FirstName.Text.Trim();if (!string.IsNullOrEmpty(firstName)){ // do something}// orif (someParam == null || string.IsNullOrEmpty(someParam.Trim())

.NET 4 String Function to Check for Empty Strings

Question is...How to Check an Empty Strings or not in ASP.NET 4.0?How many times have you written code similar to this?string firstName = FirstName.Text.Trim();if (!string.IsNullOrEmpty(firstName)){ // do something}// orif (someParam == null || string.IsNullOrEmpty(someParam.Trim())

.NET 4 String Function to Check for Empty Strings

Question is...How to Check an Empty Strings or not in ASP.NET 4.0?How many times have you written code similar to this?string firstName = FirstName.Text.Trim();if (!string.IsNullOrEmpty(firstName)){ // do something}// orif (someParam == null || string.IsNullOrEmpty(someParam.Trim())

Free ebook - Accelerated C# 2010

C# 2010 offers powerful new features, and this book is the fastest path to mastering them - and the rest of C# - for both experienced C# programmers moving to C# 2010 and programmers moving to C# from another object-oriented language. Many books introduce

Free ebook - Accelerated C# 2010

C# 2010 offers powerful new features, and this book is the fastest path to mastering them - and the rest of C# - for both experienced C# programmers moving to C# 2010 and programmers moving to C# from another object-oriented language. Many books introduce

Free ebook - Accelerated C# 2010

C# 2010 offers powerful new features, and this book is the fastest path to mastering them - and the rest of C# - for both experienced C# programmers moving to C# 2010 and programmers moving to C# from another object-oriented language. Many books introduce

Convert a DataTable to a List<> using C#

Question is...Convert a DataTable to a List<> using C#To convert a DataTable to a List<> in .NET 2.0. Here’s the code to do so:// Assuming there is a DataTable called dtList<DataRow> drlist = new List<DataRow>();foreach (DataRow

Convert a DataTable to a List<> using C#

Question is...Convert a DataTable to a List<> using C#To convert a DataTable to a List<> in .NET 2.0. Here’s the code to do so:// Assuming there is a DataTable called dtList<DataRow> drlist = new List<DataRow>();foreach (DataRow

Convert a DataTable to a List<> using C#

Question is...Convert a DataTable to a List<> using C#To convert a DataTable to a List<> in .NET 2.0. Here’s the code to do so:// Assuming there is a DataTable called dtList<DataRow> drlist = new List<DataRow>();foreach (DataRow

Simplest way to Programmatically ShutDown or Restart your System using C#

Question is...Simplest way to Programmatically ShutDown or Restart your System using C#One of the ways to ShutDown or Restart your system is to use WMI (Windows Management Interface). However it does require you to write a few lines of code. I have found

Simplest way to Programmatically ShutDown or Restart your System using C#

Question is...Simplest way to Programmatically ShutDown or Restart your System using C#One of the ways to ShutDown or Restart your system is to use WMI (Windows Management Interface). However it does require you to write a few lines of code. I have found

Simplest way to Programmatically ShutDown or Restart your System using C#

Question is...Simplest way to Programmatically ShutDown or Restart your System using C#One of the ways to ShutDown or Restart your system is to use WMI (Windows Management Interface). However it does require you to write a few lines of code. I have found

Convert a String Array to a Decimal Array using C#

Question is...Convert a String Array to a Decimal Array using C# The Array.ConvertAll() method is a very useful method to convert an array of one type to an array of another type. Here’s how to use ConvertAll() to convert a String[] to Decimal[]static

Convert a String Array to a Decimal Array using C#

Question is...Convert a String Array to a Decimal Array using C# The Array.ConvertAll() method is a very useful method to convert an array of one type to an array of another type. Here’s how to use ConvertAll() to convert a String[] to Decimal[]static

Convert a String Array to a Decimal Array using C#

Question is...Convert a String Array to a Decimal Array using C# The Array.ConvertAll() method is a very useful method to convert an array of one type to an array of another type. Here’s how to use ConvertAll() to convert a String[] to Decimal[]static

Convert LowerCase and UpperCase to TitleCase in C#

Question is...Convert LowerCase and UpperCase to TitleCase in C#The String class has the ToLower() and the ToUpper() methods to convert a string to lowercase and uppercase respectively. However when it comes to converting the string to TitleCase, the

Convert LowerCase and UpperCase to TitleCase in C#

Question is...Convert LowerCase and UpperCase to TitleCase in C#The String class has the ToLower() and the ToUpper() methods to convert a string to lowercase and uppercase respectively. However when it comes to converting the string to TitleCase, the

Convert LowerCase and UpperCase to TitleCase in C#

Question is...Convert LowerCase and UpperCase to TitleCase in C#The String class has the ToLower() and the ToUpper() methods to convert a string to lowercase and uppercase respectively. However when it comes to converting the string to TitleCase, the

Convert Enum to List<> using C#

Question is...Convert Enum to List<> using C# A user recently asked me how to convert an Enum to a List<>. Here's the code to do so:class Program{ enum Days { Sat, Sun, Mon, Tue, Wed, Thu, Fri }; static void Main(string[] args) {

Convert Enum to List<> using C#

Question is...Convert Enum to List<> using C# A user recently asked me how to convert an Enum to a List<>. Here's the code to do so:class Program{ enum Days { Sat, Sun, Mon, Tue, Wed, Thu, Fri }; static void Main(string[] args) {

Convert Enum to List<> using C#

Question is...Convert Enum to List<> using C# A user recently asked me how to convert an Enum to a List<>. Here's the code to do so:class Program{ enum Days { Sat, Sun, Mon, Tue, Wed, Thu, Fri }; static void Main(string[] args) {

Find Out the Image Type without Checking its Extension using C#

Question is...Find Out the Image Type without Checking its Extension using C#My colleague called up with a query. His application accepted images to be uploaded to a central server. Later the application processed the images and separated them according

Find Out the Image Type without Checking its Extension using C#

Question is...Find Out the Image Type without Checking its Extension using C#My colleague called up with a query. His application accepted images to be uploaded to a central server. Later the application processed the images and separated them according

Find Out the Image Type without Checking its Extension using C#

Question is...Find Out the Image Type without Checking its Extension using C#My colleague called up with a query. His application accepted images to be uploaded to a central server. Later the application processed the images and separated them according

How to calculate the CPU Usage Programmatically using C#

Question is...How to calculate the CPU Usage Programmatically using C#The PerformanceCounter class represents a WindowsNT performance counter component. To read from a performance counter, we first create an instance of the PerformanceCounter class supplying

How to calculate the CPU Usage Programmatically using C#

Question is...How to calculate the CPU Usage Programmatically using C#The PerformanceCounter class represents a WindowsNT performance counter component. To read from a performance counter, we first create an instance of the PerformanceCounter class supplying

How to calculate the CPU Usage Programmatically using C#

Question is...How to calculate the CPU Usage Programmatically using C#The PerformanceCounter class represents a WindowsNT performance counter component. To read from a performance counter, we first create an instance of the PerformanceCounter class supplying

Count Words and Characters in a String using C#

Question is...Count Words and Characters in a String using C#A user recently asked me a question on how to use Regular Expressions to count words and characters in a string. Here’s how:First add a reference to System.Text.RegularExpressionsHere the strOriginal

Count Words and Characters in a String using C#

Question is...Count Words and Characters in a String using C#A user recently asked me a question on how to use Regular Expressions to count words and characters in a string. Here’s how:First add a reference to System.Text.RegularExpressionsHere the strOriginal

Count Words and Characters in a String using C#

Question is...Count Words and Characters in a String using C#A user recently asked me a question on how to use Regular Expressions to count words and characters in a string. Here’s how:First add a reference to System.Text.RegularExpressionsHere the strOriginal

Find Information about your Network Cards using C#

Find Information about your Network Cards using C#Here’s a small snippet of code of how to find out which network cards are enabled and able to transmit data on your machine. Here’s the code.Add a reference to System.Net.NetworkInformationvar nics =

Find Information about your Network Cards using C#

Find Information about your Network Cards using C#Here’s a small snippet of code of how to find out which network cards are enabled and able to transmit data on your machine. Here’s the code.Add a reference to System.Net.NetworkInformationvar nics =

Find Information about your Network Cards using C#

Find Information about your Network Cards using C#Here’s a small snippet of code of how to find out which network cards are enabled and able to transmit data on your machine. Here’s the code.Add a reference to System.Net.NetworkInformationvar nics =

Hiding a File using C#

Hiding a File using C# The FileInfo class is very useful class that contains methods for the creation, copying, deletion, moving, and opening of files. Here’s how to hide a file using C#.class Program{ static void Main(string[] args) { try

Hiding a File using C#

Hiding a File using C# The FileInfo class is very useful class that contains methods for the creation, copying, deletion, moving, and opening of files. Here’s how to hide a file using C#.class Program{ static void Main(string[] args) { try

Hiding a File using C#

Hiding a File using C# The FileInfo class is very useful class that contains methods for the creation, copying, deletion, moving, and opening of files. Here’s how to hide a file using C#.class Program{ static void Main(string[] args) { try

Retrieve a List of the Services Running on your Computer using C#

Retrieve a List of the Services Running on your Computer using C#The ServiceController class can be used to retrieve a list of the services running on your computer. The GetServices() can be used to do so. Here’s an example to list the services that

Retrieve a List of the Services Running on your Computer using C#

Retrieve a List of the Services Running on your Computer using C#The ServiceController class can be used to retrieve a list of the services running on your computer. The GetServices() can be used to do so. Here’s an example to list the services that

Retrieve a List of the Services Running on your Computer using C#

Retrieve a List of the Services Running on your Computer using C#The ServiceController class can be used to retrieve a list of the services running on your computer. The GetServices() can be used to do so. Here’s an example to list the services that

Optional parameters and named parameters in C# 4.0

Optional parameters and named parameters in C# 4.0Imagine you have two List. Two new features to C# 4.0 are optional parameters and named parameters. Optional parameters have been a part of VB.Net but it's now possible to do this in C#. Instead of using

Optional parameters and named parameters in C# 4.0

Optional parameters and named parameters in C# 4.0Imagine you have two List. Two new features to C# 4.0 are optional parameters and named parameters. Optional parameters have been a part of VB.Net but it's now possible to do this in C#. Instead of using

Optional parameters and named parameters in C# 4.0

Optional parameters and named parameters in C# 4.0Imagine you have two List. Two new features to C# 4.0 are optional parameters and named parameters. Optional parameters have been a part of VB.Net but it's now possible to do this in C#. Instead of using

List the Drives on your Computer using C#

List the Drives on your Computer using C#?Imagine you have two List. If you want to create a program to provide information about your Computer Drive, then use the System.IO.DriveInfo class. The DriveInfo class can be used to determine the drives available

List the Drives on your Computer using C#

List the Drives on your Computer using C#?Imagine you have two List. If you want to create a program to provide information about your Computer Drive, then use the System.IO.DriveInfo class. The DriveInfo class can be used to determine the drives available

List the Drives on your Computer using C#

List the Drives on your Computer using C#?Imagine you have two List. If you want to create a program to provide information about your Computer Drive, then use the System.IO.DriveInfo class. The DriveInfo class can be used to determine the drives available

Compare Two List of Strings in C#

Compare Two List of Strings in C#?Imagine you have two List. You want to quickly compare them to see if all the elements match each other. Here's how to do so:List<string> strList1 = new List<string>{ "Jack", "And", "Jill", "Went", "Up",

Compare Two List of Strings in C#

Compare Two List of Strings in C#?Imagine you have two List. You want to quickly compare them to see if all the elements match each other. Here's how to do so:List<string> strList1 = new List<string>{ "Jack", "And", "Jill", "Went", "Up",

Compare Two List of Strings in C#

Compare Two List of Strings in C#?Imagine you have two List. You want to quickly compare them to see if all the elements match each other. Here's how to do so:List<string> strList1 = new List<string>{ "Jack", "And", "Jill", "Went", "Up",

How to check if a TCP port is blocked using C#

How to check if a TCP port is blocked using C#?In order to check if a TCP port is blocked, use the System.Net and System.Net.Sockets classes as shown below:protected void Button1_Click(object sender, EventArgs e){ string host = "localhost";

How to check if a TCP port is blocked using C#

How to check if a TCP port is blocked using C#?In order to check if a TCP port is blocked, use the System.Net and System.Net.Sockets classes as shown below:protected void Button1_Click(object sender, EventArgs e){ string host = "localhost";

How to check if a TCP port is blocked using C#

How to check if a TCP port is blocked using C#?In order to check if a TCP port is blocked, use the System.Net and System.Net.Sockets classes as shown below:protected void Button1_Click(object sender, EventArgs e){ string host = "localhost";

Convert Domain Name to IP Address

How to convert Domain Name to IP Address in C#?The answer is quiet simple. Just use the System.Net.Dns classusing System.Net;protected void Page_Load(object sender, EventArgs e){ foreach (IPAddress address in Dns.GetHostAddresses("www.youraddress.com"))

Convert Domain Name to IP Address

How to convert Domain Name to IP Address in C#?The answer is quiet simple. Just use the System.Net.Dns classusing System.Net;protected void Page_Load(object sender, EventArgs e){ foreach (IPAddress address in Dns.GetHostAddresses("www.youraddress.com"))

Convert Domain Name to IP Address

How to convert Domain Name to IP Address in C#?The answer is quiet simple. Just use the System.Net.Dns classusing System.Net;protected void Page_Load(object sender, EventArgs e){ foreach (IPAddress address in Dns.GetHostAddresses("www.youraddress.com"))

Multiple Inheritance in C#

C# supports single inheritance, however they do support multiple 'interface' inheritance:Here's a sample demonstrating the same://Single Inheritancepublic class A{ public A() { }}public class B : A{ public B() { }} //Multiple Interface Inheritanceinterface

Multiple Inheritance in C#

C# supports single inheritance, however they do support multiple 'interface' inheritance:Here's a sample demonstrating the same://Single Inheritancepublic class A{ public A() { }}public class B : A{ public B() { }} //Multiple Interface Inheritanceinterface

Multiple Inheritance in C#

C# supports single inheritance, however they do support multiple 'interface' inheritance:Here's a sample demonstrating the same://Single Inheritancepublic class A{ public A() { }}public class B : A{ public B() { }} //Multiple Interface Inheritanceinterface