This is not the same from the point of view of C # in general ... but in compiled code, a variable declared as a type dynamicusually (possibly always) corresponds to a CLR field or a local type variable object.
The C # compiler is responsible for ensuring that any source code using this value applies dynamic behavior to it. objectis just a compiler used for storage. It will also apply the attribute [Dynamic]where necessary, so that other code knows that it is being processed dynamically.
, :
public class Foo
{
public dynamic someField;
}
, , :
public class Foo
{
[Dynamic]
public object someField;
}
, :
Foo foo = new Foo();
foo.someField = "hello";
Console.WriteLine(foo.someField.Length);
, , foo.someField , Length .