<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>

<channel>
	<title>Free CSharp Tutorials.com</title>
	<atom:link href="http://freecsharptutorials.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://freecsharptutorials.com</link>
	<description>Learn C# Online with Video Tutorials</description>
	<pubDate>Sun, 28 Mar 2010 20:12:56 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>C# FTP Demo</title>
		<link>http://freecsharptutorials.com/?p=43</link>
		<comments>http://freecsharptutorials.com/?p=43#comments</comments>
		<pubDate>Thu, 02 Apr 2009 21:44:35 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
		<category><![CDATA[FTP]]></category>

		<guid isPermaLink="false">http://freecsharptutorials.com/?p=43</guid>
		<description><![CDATA[How to use the FTP functions built-in to C# 
This is a more intermediate video. 
What you will learn:
1) How to create a reuseable FTPFunction class library (with three static methods: Upload, Download, GetFileList.
2) How to call the function library from both a Windows form and a Console program. 
First, I found some sample FTP [...]]]></description>
			<content:encoded><![CDATA[<p>How to use the FTP functions built-in to C# </p>
<p>This is a more intermediate video. </p>
<p>What you will learn:<br />
1) How to create a reuseable FTPFunction class library (with three static methods: Upload, Download, GetFileList.<br />
2) How to call the function library from both a Windows form and a Console program. </p>
<p>First, I found some sample FTP code from this site:<br />
<a target="_blank" href="http://aspalliance.com/1187_Building_a_Simple_FTP_Application_Using_C_20"><br />
http://aspalliance.com/1187_Building_a_Simple_FTP_Application_Using_C_20</a><br />
I wrote the console program, because I wanted to schedule a nightly download from an FTP site in order to back-up an SQL server database backup (from my dedicated server to my laptop).  </p>
<p>I decided to package the three routines in a class library, so it could be a shareable and reuseable DLL.<br />
I then am able to call it from various other programs (and in the video, I do this from a Windows form, and a Console Command-Line program).</p>
<p>Once the code was packaged in the .DLL, it was easy to call it like this: </p>
<p>Code for you to copy:</p>
<table border=1>
<tr>
<td><code>
<pre><span style="color: blue;">
    FTPFunctions.FTPFunctions.Download(FTPLocalPath,
                       FTPFilename,
                       FTPServer,
                       FTPUserid,
                       FTPPassword);
</span></pre>
<p></code></td>
</tr>
</table>
<p>I created Download, Upload, and GetFileList as static methods, so they can be called without instantiating a class. </p>
<p>Two videos coming shortly&#8230; </p>
]]></content:encoded>
			<wfw:commentRss>http://freecsharptutorials.com/?feed=rss2&amp;p=43</wfw:commentRss>
		</item>
		<item>
		<title>C# Intro to Try/Catch</title>
		<link>http://freecsharptutorials.com/?p=39</link>
		<comments>http://freecsharptutorials.com/?p=39#comments</comments>
		<pubDate>Thu, 02 Apr 2009 21:41:09 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
		<category><![CDATA[C# Try/Catch]]></category>

		<guid isPermaLink="false">http://freecsharptutorials.com/?p=39</guid>
		<description><![CDATA[Using &#8220;Try/Catch&#8221; in C# 
A Try/Catch block is the error handling mechanism for .NET. 
What you will learn here:
1) How to wrap your code in a &#8220;Try&#8221; statement
2) How to catch and display errors in the &#8220;Catch&#8221; statement
3) The three major properties of the Exception class (Message, Source, StackTrace) and the ToString() method. 
Code for [...]]]></description>
			<content:encoded><![CDATA[<p>Using &#8220;Try/Catch&#8221; in C# </p>
<p>A Try/Catch block is the error handling mechanism for .NET. </p>
<p>What you will learn here:<br />
1) How to wrap your code in a &#8220;Try&#8221; statement<br />
2) How to catch and display errors in the &#8220;Catch&#8221; statement<br />
3) The three major properties of the Exception class (Message, Source, StackTrace) and the ToString() method. </p>
<p>Code for you to copy:</p>
<table border=1>
<tr>
<td><code>
<pre><span style="color: blue;">
        private void btnAddTwoNumbers_Click(object sender, EventArgs e)
        {
            try
            {
                decimal decimalResult = AddTwoNumbers(txtNumber1.Text,
                                                      txtNumber2.Text);
                txtResult.Text = Convert.ToString(decimalResult);
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    "You did not enter two valid numbers, please try again.\r\n"
                    + " Message=" +  ex.Message + "\r\n"
                    + " Source=" +  ex.Source+ "\r\n"
                    + " StackTrace=" +  ex.StackTrace + "\r\n"
                ); 

            }

        }

        // This routine was created to demonstrate the StackTrace
        private static decimal AddTwoNumbers(string A, string B)
        {
            decimal decimalA = decimal.Parse(A);
            decimal decimalB = decimal.Parse(B);
            decimal decimalResult = decimalA + decimalB; 

            return decimalResult;
        }
    }
</span></pre>
<p></code></td>
</tr>
</table>
<p><strong>Video Demonstration:</strong></p>
<h3>Part 1 of 2 </h3>
<p><object width="640" height="505"><param name="movie" value="http://www.youtube.com/v/t9l6jz3akJU&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/t9l6jz3akJU&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="505"></embed></object></p>
<p><BR><BR></p>
<h3>Part 2 of 2 </h3>
<p><object width="640" height="505"><param name="movie" value="http://www.youtube.com/v/9FwvJYq4iwI&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/9FwvJYq4iwI&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="505"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://freecsharptutorials.com/?feed=rss2&amp;p=39</wfw:commentRss>
		</item>
		<item>
		<title>C# MessageBox</title>
		<link>http://freecsharptutorials.com/?p=36</link>
		<comments>http://freecsharptutorials.com/?p=36#comments</comments>
		<pubDate>Thu, 02 Apr 2009 21:13:03 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
		<category><![CDATA[C# MessageBox]]></category>

		<guid isPermaLink="false">http://freecsharptutorials.com/?p=36</guid>
		<description><![CDATA[Using &#8220;MessageBox&#8221; in C# 
A MessageBox is basically a pop-up box that shows a message to the user.  It may or may not provide buttons to get feedback from the user. 
What you will learn here:
1) How to use MessageBox.Show with various parameters
2) How to find out which button the user clicked-on in the [...]]]></description>
			<content:encoded><![CDATA[<p>Using &#8220;MessageBox&#8221; in C# </p>
<p>A MessageBox is basically a pop-up box that shows a message to the user.  It may or may not provide buttons to get feedback from the user. </p>
<p>What you will learn here:<br />
1) How to use MessageBox.Show with various parameters<br />
2) How to find out which button the user clicked-on in the MessageBox<br />
3) How to change the caption of the MessageBox</p>
<p>Code for you to copy:</p>
<table border=1>
<tr>
<td><code>
<pre><span style="color: blue;">
        private void buttonOkay_Click(object sender, EventArgs e)
        {
            DialogResult dr =
                 MessageBox.Show("Hello World",
                "My Caption",
                MessageBoxButtons.YesNo);
            if (dr == DialogResult.Yes)
            {
                txtResults.Text = "You chose the 'Yes' button";
            }
            if (dr == DialogResult.No)
            {
                txtResults.Text = "You chose the 'No' button";
            }
        }
</span></pre>
<p></code></td>
</tr>
</table>
<p><strong>Video Demonstration:</strong></p>
<p><object width="640" height="505"><param name="movie" value="http://www.youtube.com/v/t9l6jz3akJU&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/t9l6jz3akJU&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="505"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://freecsharptutorials.com/?feed=rss2&amp;p=36</wfw:commentRss>
		</item>
		<item>
		<title>C# Lists</title>
		<link>http://freecsharptutorials.com/?p=28</link>
		<comments>http://freecsharptutorials.com/?p=28#comments</comments>
		<pubDate>Thu, 02 Apr 2009 17:36:54 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
		<category><![CDATA[C# Lists]]></category>

		<guid isPermaLink="false">http://freecsharptutorials.com/?p=28</guid>
		<description><![CDATA[Use of Lists in C#
What you will learn here:
1) Syntax is &#8220;List&#8221; where type can be a built-in type such as int, decimal, bool, string, or can be a class (either a .NET built-in class or one of your own).
2) How to add items to a List
3) How to use a &#8220;foreach&#8221; statement to loop [...]]]></description>
			<content:encoded><![CDATA[<p>Use of Lists in C#</p>
<p>What you will learn here:<br />
1) Syntax is &#8220;List<type>&#8221; where type can be a built-in type such as int, decimal, bool, string, or can be a class (either a .NET built-in class or one of your own).<br />
2) How to add items to a List<br />
3) How to use a &#8220;foreach&#8221; statement to loop through a list<br />
4) Our specific example is a subroutine (method) that receives a List of numbers, and returns only the odd numbers in that List. </p>
<p>This video is a solution to a &#8220;quiz&#8221; I was given in an interview. A developer gave me this method signature, and asked me to scratch out the code to accomplish returning all the odd numbers in the list (at first I thought he said all the odd numbered items in the list). </p>
<table border=1>
<tr>
<td><code>
<pre><span style="color: blue;">
   public List<int> GetOddNumbers(List<int> numList)
    {
      ...
    }
</span></pre>
<p></code></td>
</tr>
</table>
<p>I had a &#8220;brain cloud&#8221; when doing this demo.  I was thinking I could divide by 2 to find out if the number was even.  I totally forgot about &#8220;modulo&#8221; division, which is what my subconscious was thinking.  If you use a backslash instead of a forward slash, then the remainder will be returned.  If you do modulo division dividing by 2, and the remainder is zero, then you have  an even number, otherwise an odd number.  That&#8217;s a more elegant way to do the odd/even test than what I did in the video below. </p>
<p>Code for you to copy:</p>
<table border=1>
<tr>
<td><code>
<pre><span style="color: blue;">
namespace CSharpList
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int> numList = new List<int>();
            numList.Add(5);
            numList.Add(6);
            numList.Add(7);
            numList.Add(20);
            numList.Add(21);
            numList.Add(22);
            numList.Add(23);
            List<int> oddNumberList = GetOddNumbers(numList); 

            Console.WriteLine("Press enter to end:");
            Console.ReadLine(); 

        }

        // Extract odd numbers from a list of numbers
        public static List<int> GetOddNumbers(List<int> numList)
        {
            List<int> returnOddNumberList = new List<int>();
            foreach (int i in numList)
            {
                int x = i / 2;
                decimal y = (decimal) i / 2M;
                if (x != y)
                {
                    // we must have an odd number
                    returnOddNumberList.Add(i);
                    Console.WriteLine(
                       "Returning odd number = " + i);
                }

            }  // end foreach 

            return returnOddNumberList;
        }

    }
}
</span></pre>
<p></code></td>
</tr>
</table>
<p><strong>Video Demonstration:</strong></p>
<p><object width="640" height="505"><param name="movie" value="http://www.youtube.com/v/-w3W4wJ8dkE&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/-w3W4wJ8dkE&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="505"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://freecsharptutorials.com/?feed=rss2&amp;p=28</wfw:commentRss>
		</item>
		<item>
		<title>C# Arrays Tutorial 1</title>
		<link>http://freecsharptutorials.com/?p=7</link>
		<comments>http://freecsharptutorials.com/?p=7#comments</comments>
		<pubDate>Sun, 08 Feb 2009 17:18:46 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
		<category><![CDATA[C# Arrays]]></category>

		<guid isPermaLink="false">http://freecsharptutorials.com/?p=7</guid>
		<description><![CDATA[1) .NET arrays are zero-based, meaning the first element of the array is at subscript-0
2) Use square brackets after the type on the left side of the equal sign to indicate an array
3) Use square brackets - and usually a number - on the right side of the equal sign to set the size of [...]]]></description>
			<content:encoded><![CDATA[<p>1) .NET arrays are zero-based, meaning the first element of the array is at subscript-0<br />
2) Use square brackets after the type on the left side of the equal sign to indicate an array<br />
3) Use square brackets - and usually a number - on the right side of the equal sign to set the size of the fixed array<br />
4) To loop through the array use either:<br />
a) &#8220;foreach&#8221; loop - no subscript required<br />
b) standard &#8220;for&#8221; loop - using a subscript</p>
<p>Code for you to copy:</p>
<table border=1>
<tr>
<td><code>
<pre><span style="color: blue;">
     string[] myStates = new string[3];
     int[] myIntegerArray = new int[10];
</span></pre>
<p></code></td>
</tr>
</table>
<p>Screen shots from the video example (cannot copy from here):<br />
<img src="/images/CSharpArrayTutorial01_01.gif" alt="" /><br />
<img src="/images/CSharpArrayTutorial01_02.gif" alt="" /></p>
<p><strong>Video Demonstration:</strong></p>
<p><object width="640" height="505"><param name="movie" value="http://www.youtube.com/v/AK5o4tguRI0&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/AK5o4tguRI0&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="505"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://freecsharptutorials.com/?feed=rss2&amp;p=7</wfw:commentRss>
		</item>
	</channel>
</rss>
