domingo, 25 de octubre de 2015

Trabajar con colecciones - Fundamentos de C# para absolutos principiantes - Microsoft Virtual Academy - MVA - Módulo 22


Nota:
  • La solución de las siguientes preguntas pueden ayudarte a aprobar el módulo, siempre y cuando sean las mismas que me mostraron.
  • Dos asteriscos (**) significa Alternativa Correcta.
  • Las preguntas y respuestas están en ingles y en español.
  • Alternativas sin marcar significa que me equivoque en la respuesta, por consiguiente depende únicamente de tu conocimiento. Si logras identificar la alternativa correcta compártela en este Sitio Web y si te tocan nuevas preguntas también. Gracias!


Trabajar con colecciones

1. In this following code:
            var books = new List<Book>() {
                new Book { ISBN = "978-1455509126", Title = "So Good They Can't Ignore You", Author = "Cal Newport"}
                new Book { ISBN = "978-0465050659", Title = "The Design of Everyday Things", Author = "Don Norman"}
                new Book { ISBN = "978-0321965516", Title = "Don't Make Me Think", Author = "Steve Krug"}
                new Book { ISBN = "978-1594484803", Title = "Drive", Author = "Daniel Pink"}
            };

What is the problem that causes this code to not compile?

En el código siguiente:
var books = new List<Book>() {
new Book { ISBN = "978-1455509126", Title = "So Good They Can't Ignore You", Author = "Cal Newport"}
new Book { ISBN = "978-0465050659", Title = "The Design of Everyday Things", Author = "Don Norman"}
new Book { ISBN = "978-0321965516", Title = "Don't Make Me Think", Author = "Steve Krug"}
new Book { ISBN = "978-1594484803", Title = "Drive", Author = "Daniel Pink"}
};

¿cuál es el problema que impide que se compile el código?

The code fails to call the constructor for each new book initialized and added to the collection (i.e., needs () after each Book)
El código no llama al constructor para cada nuevo libro inicializado y agregado a la colección (es decir, necesita () detrás de cada libro)

When using object initializers, you set properties using : instead of =
Cuando se usan inicializadores de objetos, las propiedades se definen mediante : en lugar de =

There must be a comma after each new object added to the collection
**Debe haber una coma detrás de cada nuevo objeto agregado a la colección

You do not need to add () after the List<Book> declaration in this case
En este caso, no es necesario agregar () detrás de la declaración List<Book>



Espero haber ayudado en algo. Hasta la próxima oportunidad!





No hay comentarios:

Publicar un comentario

       
free counters

Páginas vistas en total según Google