Difference between properties and constructors | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Difference between properties and constructors

Explain the difference between properties and constructors in the class discussion to me with a simple example.

20th Aug 2023, 11:37 AM
safir safir1
safir safir1 - avatar
3 Answers
+ 2
safir safir1 Have you tried to using searchbar 🔎? See this what I found after searching... https://stackoverflow.com/questions/18106594/difference-between-constructor-and-properties-in-c-sharp#:~:text=Constructors%20have%20the%20same%20name,the%20behavior%20for%20the%20class.
20th Aug 2023, 11:46 AM
Darpan kesharwani🇮🇳[Inactive📚]
Darpan kesharwani🇮🇳[Inactive📚] - avatar
+ 1
They are completely different things and serve different tasks. Why do you think they are similar?
20th Aug 2023, 3:52 PM
Евгений
Евгений - avatar
0
(constructor and property in context to C# ) since both of them used to initialized your class fields
20th Aug 2023, 11:56 PM
safir safir1
safir safir1 - avatar