Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Noticias
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #11  
Antiguo 27-04-2013
Avatar de RONPABLO
[RONPABLO] RONPABLO is offline
Miembro Premium
 
Registrado: oct 2004
Posts: 1.514
Poder: 21
RONPABLO Va por buen camino
Cita:
Empezado por rretamar Ver Mensaje
(igual sigo prefiriendo la sintaxis de Object Pascal, la encuentro mucho más amigable "programación para seres humanos" ).

Yo tambien la prefiero pero estas dos cosas de C# sería bueno tenerlas en Delphi para mi gusto.
1. el asignar propiedades.
Código:
En Delphi
type MyClass = class(tObject)
  private
      fMyProp : integer;
      function GetMyProp: integer;
      procedure SetMyProp(const Value: integer);
  public
      property MyProp : integer read GetMyProp write SetMyProp;
  end;
  
  function MyClass.GetMyProp: integer;
      begin
      result:= max(fMyProp,0);
      end;
  
  procedure MyClass.SetMyProp(const Value: integer);
      begin
      if Value >= 0 then
         fMyProp:= Value;
      end;
  



En C#


Código:
public class MyClass
{
    private int myProp = 0;
    public  int MyProp
        {
        get { return Math.Max(myProp, 0); }
        set { if (value > 0)
                  myProp = value; }
        }
}

2. try catch con finally
en C#
Código:
try
        {
            throw     New MyException("Error occurred in C#");
        }
        catch(MyException) 
        { 
            HandleMyException(); 
        }
        finally
        {
            CleanUp(); 
        }
Esto en delphi requiere de abrir dos try, el primero con el finally y el segundo con el catch
__________________
"Como pasa el tiempo..... ayer se escribe sin H y hoy con H"
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Tema para la próxima reunión de delphi en México. poliburro Debates 11 25-09-2008 16:39:07
Sacar fecha mas proxima VRO MySQL 1 26-06-2008 10:09:40
fecha mas proxima VRO Varios 1 04-10-2007 13:31:20
Avanzar a la próxima línea de error Crandel Varios 5 27-11-2006 17:35:49
La proxima versión de Delphi será compatible con la VCL y el .NET SMTZ Noticias 0 30-05-2004 09:34:16


La franja horaria es GMT +2. Ahora son las 20:05:04.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi