Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Calculadora

0

64
Vistas
What is the difference between String and string in C#?

Example ( Look at the case ):

 string s = "Hello world!"; String s = "Hello world!";

What are the guidelines for using each? And what are the differences?

12 months ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

string is a C# alias for System.String .
So technically, there is no difference. It's like int vs. System.Int32

As for guidelines, it's generally recommended to use string whenever you refer to an object.

e.g

 string place = "world";

Similarly, I think using String is generally recommended if you need to refer specifically to the class.

e.g

 string greet = String.Format("Hello {0}!", place);

This is the style Microsoft often uses in its examples .

It appears that guidance in this area may have changed, as StyleCop now requires the use of C#-specific aliases.

12 months 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 empleo Planes Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2023 PeakU Inc. All Rights Reserved.