Answer the question
In order to leave comments, you need to log in
How to automatically initialize object properties?
Good afternoon.
There is an array of POCO objects with properties.
While there are 7 of these properties, there may be more.
From this array, another array of objects of the type I need is selectively created and values are assigned to properties:
pocoList.ForEach(s =>
{
new SomeTypeObject()
{
Id = s.Id,
Path = s.Path
Tag = s.Tag
}
});
Answer the question
In order to leave comments, you need to log in
- this is the normal way
- the other way is the constructor
- do you know other ways?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question