Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

214
Vistas
What is VB.NET equivalent of this way to create instance?

In C# you can create an instance like this:

Custom mycustomelement = new Custom { ElenentName = "My Custom Element" };

I wonder how I can create instance like this in Visual Basic and what this type of creating instance is called.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

It's called an object initializer, and the corresponding VB.NET syntax is:

Dim mycustomelement As New Custom With { .ElementName = "My Custom Element" }

(Note the dot (.) before the property name, which matches the syntax of VB's With statement.)


Note that there is a subtle difference between C# and VB when using the object initializer syntax for anonymous types: In C#, all properties are immutable; in VB, they are mutable unless they are initialized with the Key keyword.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda