andres's picture From andres rss RSS  subscribe Subscribe

clase 6 



 
Views:  4652
Downloads:  83
Published:  September 30, 2007
 
2
save to favorite
ask author to add audio Ask author to add audio
Share plick with friends Share
mark as inappropriate Mark as inappropriate
 
Related Plicks
clase 4

clase 4

From: andres
Views: 6523 Comments: 0
Clases
C#: las clases son declaradas mediante class
Atributos
Métodos
En C# todo método es una función
Sobrecarga de Métodos (more)

 
clase 5

clase 5

From: andres
Views: 8224 Comments: 0
Conversión de tipos
Boxing - Unboxing
Métodos y atributos Estáticos
Partial Class
Herencia
Invocando el Constructor Base en (more)

 
plataforma java J2EE

plataforma java J2EE

From: emily
Views: 8831 Comments: 0
Programación no Estructurada.
Programación Estructurada.
Programación Orientada a Objetos.
El modelo MFC.
Programación Orientada a Componentes. (more)

 
interrogativas

interrogativas

From: hiratufail
Views: 634 Comments: 0

 
clase 3

clase 3

From: andres
Views: 6245 Comments: 0
¿Qué es un Framework?
¿Qué es Framework 2.0?

¿Qué problemas resuelve .NET?
.NET Framework
CLR – Common Language Runtime (more)

 
clase 1

clase 1

From: andres
Views: 11949 Comments: 0
Primera Clase del curso de PreMas (Introduccion al Curso de Desarrollador Cinco Estrellas de Microsoft)
 
See all 
 
More from this user
clase 5

clase 5

From: andres
Views: 8224
Comments: 0

clase 4

clase 4

From: andres
Views: 6523
Comments: 0

clase 3

clase 3

From: andres
Views: 6245
Comments: 0

Clase 2

Clase 2

From: andres
Views: 7594
Comments: 0

clase 1

clase 1

From: andres
Views: 11949
Comments: 0

 
See all 
 
Place your Ad here for $2.00 a month
Sample Ad
Advertise your business on myplick.
Only $2.00 a month.
 
 URL:          AddThis Social Bookmark Button
Embed Thin Player: (fits in most blogs)
Embed Full Player :
 
 

Name

Email (will NOT be shown to other users)

 

 
 
Comments:
 
 
Notes:
 
 
Slide 1: Clase 6
Slide 2: Examen de nivel inicial
Slide 3: Manejando excepciones ¿Por qué usar excepciones?  Objetos Exception  Usando bloques try-catch  Bloques catch múltiples 
Slide 4: ¿Por qué usar excepciones? El manejo de errores procedimental tradicional es poco prolijo  Lógica del programa int errorCode = 0; FileInfo source = new FileInfo("code.cs"); if (errorCode == -1) goto Failed; int length = (int)source.Length; if (errorCode == -2) goto Failed; char[] contents = new char[length]; if (errorCode == -3) goto Failed; // Succeeded ... Failed: ... Manejo de errores
Slide 5: Objetos Exception Exception SystemException OutOfMemoryException IOException NullReferenceException ApplicationException
Slide 6: Usando bloques try-catch try { Console.WriteLine(“Ingrese un número"); Lógica de programa int i = int.Parse(Console.ReadLine()); } catch (OverflowException caught) { Console.WriteLine(caught); } Manejo de errores
Slide 7: Bloques catch múltiples try { Console.WriteLine(“Ingrese un número"); int i = int.Parse(Console.ReadLine()); Console.WriteLine(“Ingrese otro"); int j = int.Parse(Console.ReadLine()); int k = i / j; } catch (DivideByZeroException caught) {…} catch (Exception caught) {…} Las excepciones más generales van al final!!
Slide 8: La sentencia throw throw expresión ; if (minuto < 1 || minuto >= 60) { throw new InvalidTimeException(minuto + " no es un minuto valido"); // !! Punto no alcanzado !! }
Slide 9: La sentencia finally Las sentencias del bloque finally son ejecutadas siempre  Monitor.Enter(x); try { ... } finally { Monitor.Exit(x); } Los bloques catch son opcionales
Slide 10: Laboratorio Realizar el ejercicio nº 1
Slide 11: Propagación de excepciones Podemos anidar excepciones el manejo de excepciones, propagando la excepción hacia los bloques externos static void Main(string[] args) { try { try { int y=0; int x = 2 / y; } catch (Exception e2){ Console.WriteLine("Excepción de adentro"); throw e2; }//del try de adentro } catch (Exception e){ Console.WriteLine("Excepción de afuera"); throw e; }del try de afuera }//del main
Slide 12: Propagación de excepciones También podemos propagar excepciones en invocaciones a métodos static void Main(string[] args) { try { ManejoExcepcion();} catch (Exception e){ Console.WriteLine("Excepción de afuera");throw e; } } private static void ManejoExcepcion(){ try{ int y = 0; int x = 2 / y; } catch (Exception e2) { Console.WriteLine("Excepción de adentro"); throw e2; } }
Slide 13: Laboratorio Ejercicio nº 2

   
Time on Slide Time on Plick
Slides per Visit Slide Views Views by Location
close
Please fill out the form below. You will be asked to make your payment to Myplick (Eastar Technologies) via Paypal. Your request will be processed within 24 hours after your submission.
 
Title (max 25 characters)
Link (placed on title)
Content (max 100 characters)
You have successfully submitted your ad request. Please send your payment to ericandlei@myplick.com via PAYPAL.
Ad submission failed. Please report the problem to ericandlei@myplick.com.