Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does it compile?

Tags:

c#

asp.net

            var cv = (new CustomValidator()
            {
                 ErrorMessage="Formato de telefone inválido",
                 ControlToValidate = "txtTelefoneIni", //<-- see the extra comma
            });
like image 446
Cleiton Avatar asked Oct 23 '09 17:10

Cleiton


People also ask

Why does code need to be compiled?

Compiled languages are converted directly into machine code that the processor can execute. As a result, they tend to be faster and more efficient to execute than interpreted languages. They also give the developer more control over hardware aspects, like memory management and CPU usage.

What does it mean to compile a file?

Compiling is the transformation from Source Code (human readable) into machine code (computer executable). A compiler is a program.

What do you mean by compiled?

1 : to compose out of materials from other documents compile a statistical chart. 2 : to collect and edit into a volume compile a book of poems. 3 : to build up gradually compiled a record of four wins and two losses. 4 : to run (something, such as a program) through a compiler.

Why do we compile in C?

Compiling a C program:- Behind the Scenes. C is a mid-level language and it needs a compiler to convert it into an executable code so that the program can be run on our machine.


1 Answers

Because it is legal syntax.

Really, it is.

When you're constructing an object using the object initializer syntax, you're allowed to leave a trailing comma after the last item, even if you end the initializer block there and then.

The reason behind it is probably that it makes it easier to come back and edit it later, as forgetting to add a comma after the previously-last-item is the #1 compile-time-problem with object-initializers.

like image 64
Lasse V. Karlsen Avatar answered Oct 12 '22 08:10

Lasse V. Karlsen