views:

51

answers:

2

Is there any execution speed difference between the following two lines of code? I cannot tell from looking at the IL:

int x = MainObject.Field1;
int x = MainObject.Public.Fields.Field1;

I know from Delphi (native code), there is no difference.

A: 

There is no difference whatsoever. (assuming you mean, as you say in the title, fields)

qstarin
+1  A: 

Accesing by '.' to deeper class structure elements - NO, but method invocation with it - YES.

UGEEN
This question is meaningless in the context of method invocations.
qstarin
Invocations:int x = MainObject.Field1.ToString().Trim().Length;
UGEEN