What is the difference between the curly braces{} and the normal bracket() in c# | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the difference between the curly braces{} and the normal bracket() in c#

I'm kinda confused about when to use them...I normally interchange them.

4th Sep 2017, 12:06 PM
Ben Acq
Ben Acq - avatar
2 Answers
+ 5
The parenthesis define an explicit expression and the curly brackets define a regular C# code block. The difference is that the explicit expression submits it's output directly as a part of the HTML mark up and the code block doesn't. This is why when the second approach is used, the Render method should be called in order to render the component's mark up.  https://stackoverflow.com/questions/18227852/using-statement-vs-curly-brackets
4th Sep 2017, 12:14 PM
GAWEN STEASY
GAWEN STEASY - avatar
0
ok I guess I'm cool now..thank you
4th Sep 2017, 2:02 PM
Ben Acq
Ben Acq - avatar