Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
try {
..
} catch (Exception ex) {
..
}
try
{
...
}
catch (FileNotFoundException ex)
{
...
}
catch (NullArgumentException ex)
{
...
}
catch (Exception ex)
{
....
}
using System;
namespace De.Tutorials.ExceptionExamples
{
/// <summary>
/// Zusammendfassende Beschreibung für Class1.
/// </summary>
class ExceptionExample
{
/// <summary>
/// Der Haupteinstiegspunkt für die Anwendung.
/// </summary>
[STAThread]
static void Main(string[] args)
{
try
{
SomeErrorProneDatabaseInteraction();
}
catch(DataAccessException dae)
{
//Handle the Exception...
Console.WriteLine(dae.ToString());
}
Console.ReadLine();
}
static void SomeErrorProneDatabaseInteraction()
{
if(new Random().Next(3) % 2 == 0)
{
throw new DataAccessException("Severe DataAccessFailure", new System.Data.DataException("database puked because connection pool was full",new SystemException("help I need somebody heeeeeeelp")));
}
else
{
throw new DataAccessException("Informal database indisposedness",new System.Data.ConstraintException("you inserted an invalid entry... you bastard!"));
}
}
}
class DataAccessException : Exception
{
public DataAccessException(String message, Exception exception) : base(message, exception)
{
}
}
}