Object initializer performance

后端 未结 7 2084
遇见更好的自我
遇见更好的自我 2021-01-04 01:47

Is the object initializer in c# 3.0 faster then the regular way?

Is this faster

Object object = new Object
{
    id = 1;
}

than th

7条回答
  •  感情败类
    2021-01-04 02:05

    If there are any performance differences (which I doubt there are any), they're negligible. Optimize only where profiler told you to do so.

提交回复
热议问题