✅ positional parameters
dose this sentence
You can use positional parameters in a primary constructor to create and instantiate a type with immutable properties.
form docs means that the record create a primary constractor that contains the parameter , or it means that i can create a primary constractor inside the record type with the parameter , as i read the record creates by default a primary constructor and a proparites that is inilized using this constractor12 Replies
huh
I think it always creates a constructor with a parameter for each property, but you can create more regular constructors that call into it.
But you should just look at the lowered code
SharpLab
C#/VB/F# compiler playground.
this thing allows you to view lowered code
I checked it on the sharplap ,it creates a constructor by default without need to create a new one that why I am asking ,the sentence above is not clear
What's wrong
just very broken English
I had to reread it 5 times to understand
but it's fine
constructor*
primary constructors is a new feature
this makes a constructor + a field for example
on records that will make a public property instead of a field, always
obviously you can't have two of these
due to how the syntax is
Which sentence
I get the sentence from the docs and I want to know what dose it mean think it's clear , on the other hand i am not here for my English evaluation I am here for technical question 😆
Let's get back to technical,traditional constructor can do all of this as before c#12 , I can create a ctor with parameters in c# before version 12, I don't see any different than traditional constructor
It's just terser syntax
It lowers to a regular constructor
I don't care how good your English is. I just explained why they said "huh"
I am not a native English speaker
😆
me neither
And maybe the one that says huh is not too
😆
Anyway, thank you very much for the explanation
you're welcome