Syntactic sugar for reflection? #4159
-
Just an idea: |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
I don't think that that is a good idea because people will be more tempted to use reflection, which is slow. Also i don't think that it is clear what the syntax does to someone who doesn't know the syntax. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
typeof(C)
orc.GetType()
that it needs to be reduced by a few characters?GetProperty
which take more than just a string?GetXXX
methods, e.g. for methods/events/etc? Why does$(Class.Foo)
get you aPropertyInfo
, and not aMethodInfo
orEventInfo
, etc?dynamic
which may help with some of these cases. E.g.typeof(C).GetProperty("Foo").Invoke(c)
is similar to((dynamic)c).Foo