VB.NET ¿equivalente a la abreviatura de la propiedad C#?


¿Hay un VB.NET equivalente al C#:

public string FirstName { get; set; }

Sé que puedes hacer

Public Property name() As String
   Get
      Return _name.ToString
   End Get
   Set(ByVal value As String)
       _name = value
   End Set
End Property

Pero parece que no puedo buscar en Google una respuesta en una taquigrafía de Visual Basic.

Author: Peter Mortensen, 2009-01-20

3 answers

No hay taquigrafía para Visual Studio 2008 o anterior para VB.NET.

En Visual Studio 2010 y posteriores, puede usar la siguiente abreviatura:

public property FirstName as String

Esto se manejará como su versión corta en C# es-creo que lo llaman "Propiedad automática"

Ver también: Propiedades implementadas automáticamente (Visual Basic)

 142
Author: Stefan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-09-30 15:51:00

En Visual Studio 2008, después de escribir solo la palabra clave Property, presione la tecla Tab. Pegará un fragmento de plantilla para usted que puede llenar muy rápidamente.

Pero sí, no hay un reemplazo de un acceso directo de tipo Visual Basic 10 en Visual Basic 9.

 22
Author: Ali,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-06-27 19:53:05

Desafortunadamente, Visual Basic 9 (que viene con.NET 3.5/Visual Studio 2008) no tiene propiedades automáticas.

 4
Author: Jon Limjap,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2009-01-20 03:28:35