c# - Standard term for instantiation practice -


is there standard term practice of instantiate class without using explicit constructor instead initializing of properties?

new someclass { propertya = true, propertyb = "ugly code ugly" }; 

i'm guessing there standard not judgemental term , there negative term.

** --- ** --- edited post clarifying comments , answers --- *** ---

object initialization is.

after reading comments understand object initialization not bad practice; problem lack of defined constructors in favor of object initialization spread across solution, makes solution harder maintain , understand.

an example of bad use of object initialization:

  • class student has 10 properties including code , program.
  • the code instantiating class 10+ different points.
  • every time, code , program being defined through object initialization.

in case, class student should have constructor enforcing code , program passed on instantiation.

it called object initialization

https://msdn.microsoft.com/en-us/library/bb384062.aspx


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -