Click here to Skip to main content
15,887,027 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Code special to MVC Pin
Dave Kreskowiak28-Jun-16 4:39
mveDave Kreskowiak28-Jun-16 4:39 
AnswerRe: Code special to MVC Pin
Richard Deeming28-Jun-16 3:12
mveRichard Deeming28-Jun-16 3:12 
GeneralRe: Code special to MVC Pin
larsp77728-Jun-16 3:50
larsp77728-Jun-16 3:50 
GeneralRe: Code special to MVC Pin
Richard Deeming28-Jun-16 3:56
mveRichard Deeming28-Jun-16 3:56 
GeneralRe: Code special to MVC Pin
larsp77728-Jun-16 4:01
larsp77728-Jun-16 4:01 
GeneralRe: Code special to MVC Pin
larsp77728-Jun-16 4:29
larsp77728-Jun-16 4:29 
GeneralRe: Code special to MVC Pin
Dave Kreskowiak28-Jun-16 4:41
mveDave Kreskowiak28-Jun-16 4:41 
GeneralRe: Code special to MVC Pin
Pete O'Hanlon28-Jun-16 4:50
mvePete O'Hanlon28-Jun-16 4:50 
It's just syntactic sugar designed to reduce the amount of code you type. It doesn't render any of your previous knowledge obsolete, it's just that it's easier to read something like this:
C#
Movie movie = new Movie
{
  Name = "Batman vs Superman",
  ReleaseYear = 2016,
  Rating = 4.5
}
Than it is to read this:
C#
Movie movie = new Movie();
movie.Name = "Batman vs Superman";
movie.ReleaseYear = 2016;
movie.Rating = 4.5;
It also means you don't have to provide multiple overloaded constructors if you're just providing properties that you want to populate. I don't want to blow your mind, but you can extend this concept to also include collection initialisation as well. Suppose you added a list of actors to your class, you can initialise it like this:
C#
Movie movie = new Movie
{
  Name = "Batman vs Superman",
  ReleaseYear = 2016,
  Rating = 4.5,
  Actors = new List<string> { "Ben Afleck", "Jessie Eisenberg", "Gal Gadot", "Henry Cavill" }
};

This space for rent

AnswerRe: Code special to MVC Pin
Member 126169193-Jul-16 19:49
Member 126169193-Jul-16 19:49 
QuestionAsp.net mvc5,html5 Pin
Member 1236843723-Jun-16 21:30
Member 1236843723-Jun-16 21:30 
SuggestionRe: Asp.net mvc5,html5 Pin
CHill6024-Jun-16 0:27
mveCHill6024-Jun-16 0:27 
AnswerRe: Asp.net mvc5,html5 Pin
Dave Kreskowiak24-Jun-16 3:59
mveDave Kreskowiak24-Jun-16 3:59 
AnswerRe: Asp.net mvc5,html5 Pin
Gerry Schmitz24-Jun-16 4:10
mveGerry Schmitz24-Jun-16 4:10 
AnswerRe: Asp.net mvc5,html5 Pin
Nathan Minier28-Jun-16 1:24
professionalNathan Minier28-Jun-16 1:24 
QuestionGeneric Function for executing any parametric/non parametric function using C# Pin
Anuj Srivastava - 116-Jun-16 0:48
Anuj Srivastava - 116-Jun-16 0:48 
AnswerRe: Generic Function for executing any parametric/non parametric function using C# Pin
Pete O'Hanlon6-Jun-16 0:58
mvePete O'Hanlon6-Jun-16 0:58 
GeneralRe: Generic Function for executing any parametric/non parametric function using C# Pin
Anuj Srivastava - 116-Jun-16 1:14
Anuj Srivastava - 116-Jun-16 1:14 
GeneralRe: Generic Function for executing any parametric/non parametric function using C# Pin
Pete O'Hanlon6-Jun-16 2:00
mvePete O'Hanlon6-Jun-16 2:00 
QuestionHow to clear Parser error in MVC 4? Pin
divyashasha1-Jun-16 8:31
divyashasha1-Jun-16 8:31 
AnswerRe: How to clear Parser error in MVC 4? Pin
Dave Kreskowiak1-Jun-16 8:53
mveDave Kreskowiak1-Jun-16 8:53 
SuggestionRe: How to clear Parser error in MVC 4? Pin
ZurdoDev3-Jun-16 1:57
professionalZurdoDev3-Jun-16 1:57 
GeneralRe: How to clear Parser error in MVC 4? Pin
Richard MacCutchan3-Jun-16 2:45
mveRichard MacCutchan3-Jun-16 2:45 
GeneralRe: How to clear Parser error in MVC 4? Pin
ZurdoDev3-Jun-16 2:50
professionalZurdoDev3-Jun-16 2:50 
GeneralRe: How to clear Parser error in MVC 4? Pin
Akshay A Phadke20-Jun-16 1:36
Akshay A Phadke20-Jun-16 1:36 
QuestionHow to correct this error? Pin
divyashasha31-May-16 23:27
divyashasha31-May-16 23:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.