<?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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>C# kódok &#187; TragetSite</title>
	<atom:link href="http://users.atw.hu/csharpkodok/" rel="self" type="application/rss+xml" />
	<link>http://users.atw.hu/csharpkodok</link>
	<description>Csharp kódok gyüjteménye</description>
	<lastBuildDate>Fri, 07 Aug 2009 11:44:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>TragetSite</title>
		<link>http://users.atw.hu/csharpkodok/?p=94</link>
		<comments>http://users.atw.hu/csharpkodok/?p=94#comments</comments>
		<pubDate>Sat, 25 Jul 2009 07:41:02 +0000</pubDate>
		<dc:creator>nameless</dc:creator>
				<category><![CDATA[elmélet]]></category>
		<category><![CDATA[kód]]></category>
		<category><![CDATA[TragetSite]]></category>

		<guid isPermaLink="false">http://users.atw.hu/csharpkodok/?p=94</guid>
		<description><![CDATA[TragetSite tulajdonságok:


using System;
&#160;
namespace Program
{
    class Radio
    {
        public void TurnOn(bool on)
        {
            if (on)
           [...]]]></description>
			<content:encoded><![CDATA[<p>TragetSite tulajdonságok:<br />
<span id="more-94"></span></p>

<div class="wp_syntax"><div class="code"><pre class="language" style="font-family:monospace;">using System;
&nbsp;
namespace Program
{
    class Radio
    {
        public void TurnOn(bool on)
        {
            if (on)
                Console.WriteLine(&quot;Jamming...&quot;);
            else
                Console.WriteLine(&quot;Quite time...&quot;);
        }
    }
&nbsp;
    class Car
    {
        //max sebesség konstansa
        public const int MaxSpeed = 100;
&nbsp;
        //Belső állapot adatok
        private int currSpeed;
        private string petName;
&nbsp;
        //az autó még mindig működőképes?
        private bool CarIsDead;
&nbsp;
        //Az autónak van egy rádiója
        private Radio theMusicBox = new Radio();
&nbsp;
        //Konstruktorok
        public Car() { }
        public Car(string name, int currSp)
        {
            currSpeed = currSp;
            petName = name;
        }
&nbsp;
        //Rádió be?
        public void CrankTunes(bool state)
        {
            theMusicBox.TurnOn(state);
        }
&nbsp;
        //Kivételt jelez, hogyha a felhasználó a MaxSpeed értéke fölé gyorsítja za autót.
        public void Accelerate(int delta)
        {
            if (CarIsDead)
                Console.WriteLine(&quot;{0} is out of order...&quot;, petName);
            else
            {
                currSpeed += delta;
                if (currSpeed &amp;gt; MaxSpeed)
                {
                    CarIsDead = true;
                    currSpeed = 0;
&nbsp;
                    //Kivétel kiváltása a throw segítségével
                    throw new Exception(string.Format(&quot;{0} has overheated!&quot;,petName));
                }
                else
                    Console.WriteLine(&quot;=&amp;gt; CurrSpeed = {0}&quot;, currSpeed);
            }
        }
&nbsp;
    }
&nbsp;
    class MainClass
    {
        public static void Main()
        {
            Console.WriteLine(&quot;*****Simple Exception Example*****&quot;);
            Console.WriteLine(&quot;=&amp;gt; Creating a car and steppong on it!&quot;);
            var myCar = new Car(&quot;David&quot;, 20); //zippy a neve és jelenleg 20-szal megyünk
            myCar.CrankTunes(true); //rádió bekapcsolva
&nbsp;
            try
            {
                for (int i = 0; i &amp;lt; 10; i++)
                    myCar.Accelerate(10); //10-zel nő a sebesség addig, amíg elnem éri a 100-at, utána felrobban
            }
            catch (Exception ex)
            {
                Console.WriteLine(&quot;*** Error! ***&quot;);
&nbsp;
               //***************************************
                 Console.WriteLine(&quot;Method: {0}&quot;, ex.TargetSite);
                Console.WriteLine(&quot;Class defining member: {0}&quot;,ex.TargetSite.DeclaringType);
                Console.WriteLine(&quot;Member type: {0}&quot;, ex.TargetSite.MemberType);
               //****************************************        
&nbsp;
                Console.WriteLine(&quot;Message: {0}&quot;, ex.Message);
                Console.WriteLine(&quot;Source: {0}&quot;, ex.Source);
            }
&nbsp;
            //A hibát kezeltük, a program FOLYTATÓDIK
            Console.WriteLine(&quot;\n***** Out of Exception logic *****&quot;);
            Console.ReadKey();
        }
    }
&nbsp;
}</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://users.atw.hu/csharpkodok/?feed=rss2&amp;p=94</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
