Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Diagnostics;
- public class Contador
- {
- private Stopwatch cronometro;
- public Contador ()
- {
- cronometro = Stopwatch.StartNew ();
- Console.WriteLine ("Se ha instanciado un objeto.");
- }
- public void MostrarDuracion ()
- {
- Console.WriteLine ("La instancia {0} ha tenido una duración de: {1}.", this, cronometro.Elapsed);
- }
- ~Contador ()
- {
- Console.WriteLine ("Se iniciado la finalización del objeto.");
- cronometro.Stop ();
- Console.WriteLine ("La instancia {0} ha tenido una duración de: {1}.", this, cronometro.Elapsed);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement