<?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>try &#8211; Curso Online de C# .NET</title>
	<atom:link href="//www.tomasvasquez.com.br/cursocsharp/tag/try/feed" rel="self" type="application/rss+xml" />
	<link>//www.tomasvasquez.com.br/cursocsharp</link>
	<description>Uma iniciativa de Tomás Vásquez</description>
	<lastBuildDate>Sun, 06 May 2018 04:22:10 +0000</lastBuildDate>
	<language>pt-BR</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.9.8</generator>
	<item>
		<title>Exceptions mais comuns</title>
		<link>//www.tomasvasquez.com.br/cursocsharp/tratamento-de-erros/exceptions-mais-comuns</link>
		<pubDate>Sat, 29 Aug 2009 21:47:15 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Tratamento de Erros]]></category>
		<category><![CDATA[catch]]></category>
		<category><![CDATA[Erros]]></category>
		<category><![CDATA[Exceptions]]></category>
		<category><![CDATA[finally]]></category>
		<category><![CDATA[try]]></category>

		<guid isPermaLink="false">//www.tomasvasquez.com.br/cursocsharp/?p=260</guid>
		<description><![CDATA[O .NET Framework disponibiliza uma vasta coleção de Exceptions para representar situações adversas causadas por um programa. Dentre elas as mais comuns de encontrar são: Exception Quando é criada System.OutOfMemoryException Alocação de memória com new falha. System.StackOverflowException Pilha exaurida, geralmente quando alguma chamada recursiva é chamada sem limites. System.NullReferenceException Objeto contendo um valor null referenciado. &#8230; <a href="//www.tomasvasquez.com.br/cursocsharp/tratamento-de-erros/exceptions-mais-comuns" class="more-link">Continue lendo <span class="screen-reader-text">Exceptions mais comuns</span> <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>O .NET Framework disponibiliza uma vasta coleção de Exceptions para representar situações adversas causadas por um programa.</p>
<p>Dentre elas as mais comuns de encontrar são:</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="288"><strong>Exception </strong></td>
<td width="327"><strong>Quando é criada</strong></td>
</tr>
<tr>
<td width="288">System.OutOfMemoryException</td>
<td width="327">Alocação   de memória com new falha.</td>
</tr>
<tr>
<td width="288">System.StackOverflowException</td>
<td width="327">Pilha   exaurida, geralmente quando alguma chamada recursiva é chamada sem limites.</td>
</tr>
<tr>
<td width="288">System.NullReferenceException</td>
<td width="327">Objeto contendo um valor null referenciado.</td>
</tr>
<tr>
<td width="288">System.TypelnitializationException</td>
<td width="327">O   construtor gera uma exception e não existe um catch dentro do   construtor.</td>
</tr>
<tr>
<td width="288">System.InvalidCastException</td>
<td width="327">Conversão   explícita é inválida.</td>
</tr>
<tr>
<td width="288">System.ArrayTypeMismatchException</td>
<td width="327">O   tipo atribuído ao array é incompatível com o tipo do array.</td>
</tr>
<tr>
<td width="288">System.IndexOutOfRangeException</td>
<td width="327">Indexação   de array fora de faixa: menor que zero ou maior que o máximo possível.</td>
</tr>
<tr>
<td width="288">System.MulticastNotSupportedException</td>
<td width="327">Erro   na execução de chamada de um delegate multicast porque o delegate não tem o   tipo de retorno void.</td>
</tr>
<tr>
<td width="288">System.ArithmeticException</td>
<td width="327">Classe   base de outras exceptions como DivideByZeroException e OverflowException.</td>
</tr>
<tr>
<td width="288">System.DivideByzeroException</td>
<td width="327">Divisão   por zero em tipos inteiros.</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			</item>
		<item>
		<title>try/catch/finally</title>
		<link>//www.tomasvasquez.com.br/cursocsharp/tratamento-de-erros/trycatchfinally</link>
		<pubDate>Sat, 29 Aug 2009 20:53:32 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Tratamento de Erros]]></category>
		<category><![CDATA[catch]]></category>
		<category><![CDATA[Erros]]></category>
		<category><![CDATA[Exceptions]]></category>
		<category><![CDATA[finally]]></category>
		<category><![CDATA[try]]></category>

		<guid isPermaLink="false">//www.tomasvasquez.com.br/cursocsharp/?p=258</guid>
		<description><![CDATA[Existe um bloco que contém as funções tanto de tratamento de erro como de finalização. A sintaxe é a seguinte: Veja um exemplo: using System; public class EHClass { public static void Main () { try { Console.WriteLine("Executando o try."); throw new NullReferenceException(); } catch(NullReferenceException e) { Console.WriteLine("Capturando a exception 1."); } catch { Console.WriteLine("Capturando &#8230; <a href="//www.tomasvasquez.com.br/cursocsharp/tratamento-de-erros/trycatchfinally" class="more-link">Continue lendo <span class="screen-reader-text">try/catch/finally</span> <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Existe um bloco que contém as funções tanto de tratamento de erro como de finalização. A sintaxe é a seguinte:</p>
<p>Veja um exemplo:</p>
<pre lang="csharp" line="1">using System;
public class EHClass
{
      public static void Main ()
      {
            try
            {
                  Console.WriteLine("Executando o try.");
                  throw new NullReferenceException();
            }
            catch(NullReferenceException e)
            {
                  Console.WriteLine("Capturando a exception 1.");
            }
            catch
            {
                  Console.WriteLine("Capturando a exception 1.");
            }
            finally
            {
                  Console.WriteLine("Executando o finally.");
            }
      }
}</pre>
]]></content:encoded>
			</item>
		<item>
		<title>Liberando Recursos</title>
		<link>//www.tomasvasquez.com.br/cursocsharp/tratamento-de-erros/liberando-recursos</link>
		<pubDate>Sat, 29 Aug 2009 20:49:33 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Tratamento de Erros]]></category>
		<category><![CDATA[catch]]></category>
		<category><![CDATA[Erros]]></category>
		<category><![CDATA[Exceptions]]></category>
		<category><![CDATA[finally]]></category>
		<category><![CDATA[try]]></category>

		<guid isPermaLink="false">//www.tomasvasquez.com.br/cursocsharp/?p=256</guid>
		<description><![CDATA[Quando uma exception é disparada, a execução é desviada para a rotina de tratamento e não retorna onde estava. Este comportamento normalmente é desejável, mas existem alguns casos em que um certo fragmento de código deve ser chamado incondicionalmente, quer tenha ou não dado uma exception. Por exemplo, podemos ter alocado memória que deve ser &#8230; <a href="//www.tomasvasquez.com.br/cursocsharp/tratamento-de-erros/liberando-recursos" class="more-link">Continue lendo <span class="screen-reader-text">Liberando Recursos</span> <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Quando uma exception é disparada, a execução é desviada para a rotina de tratamento e não retorna onde estava. Este comportamento normalmente é desejável, mas existem alguns casos em que um certo fragmento de código deve ser chamado incondicionalmente, quer tenha ou não dado uma exception. Por exemplo, podemos ter alocado memória que deve ser liberada incondicionalmente. Para estes casos, precisamos do “try/finally”. A sintaxe é a seguinte:</p>
<pre lang="csharp" line="1">try
{
      i = (int) o;      // Conversão inválida, o tem uma strinq,
}
finally
{
      Console. Write("i = {0}", i);
}</pre>
<p>Veja um exemplo:</p>
<pre lang="csharp" line="1">using System;
public class Class1
{
      public static void Main()
      {
            int i = 123;
            string s = "Some string",
            object o = s;
            try
            {
                  i = (int) o;      // Conversão inválida:
                  // o tem uma strinq
            }
            finally
            {
                  Console.Write("i = {0}", i);
            }
      }
}</pre>
]]></content:encoded>
			</item>
		<item>
		<title>Criando uma exception</title>
		<link>//www.tomasvasquez.com.br/cursocsharp/tratamento-de-erros/criando-uma-exception</link>
		<pubDate>Sat, 29 Aug 2009 20:34:02 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Tratamento de Erros]]></category>
		<category><![CDATA[catch]]></category>
		<category><![CDATA[Erros]]></category>
		<category><![CDATA[Exceptions]]></category>
		<category><![CDATA[try]]></category>

		<guid isPermaLink="false">//www.tomasvasquez.com.br/cursocsharp/?p=253</guid>
		<description><![CDATA[O seu código pode criar uma exception com o comando throw. Normalmente as exceptions são criadas por bibliotecas. Veja um exemplo: ... public object Pop() { if (first == null) throw new Exception("Can't Pop from an empty Stack."); else { object teme = first.Value; first = first.Next; return teme; } } ... O comando throw &#8230; <a href="//www.tomasvasquez.com.br/cursocsharp/tratamento-de-erros/criando-uma-exception" class="more-link">Continue lendo <span class="screen-reader-text">Criando uma exception</span> <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>O seu código pode criar uma exception com o comando throw. Normalmente as exceptions são criadas por bibliotecas. Veja um exemplo:</p>
<pre lang="csharp" line="1">...
public object Pop()
{
      if (first == null)
            throw new Exception("Can't Pop from an empty Stack.");
      else
      {
            object teme = first.Value;
            first = first.Next;
            return teme;
      }
}
...</pre>
<p>O comando throw é usado normalmente junto com as estruturas try/catch, mas isto não é uma regra.</p>
]]></content:encoded>
			</item>
	</channel>
</rss>
