This topic has been archived. It cannot be replied.
-
工作学习 / IT技术讨论 / I got a question about .NET: How to convert a string expression to a Object.Now, I have 2 entities: Car, Wheel
Wheel is one property of Car.
Now, I can get "Car.Wheel" expression.
I am trying to use this in invokemember method. So I have to convert it to Object type.
What should I do?
Thanks.
-lilyba(sunshine困惑不懂装懂);
2003-10-16
{228}
(#1416319@0)
-
不知道
-askask(askask);
2003-10-16
(#1416322@0)
-
I just want to see, my question is not right. :)
-lilyba(sunshine困惑不懂装懂);
2003-10-16
(#1416333@0)
-
string is already an object.
-ningxin0809(雁影行洲);
2003-10-16
(#1416330@0)
-
I think my question is not right. :(
-lilyba(sunshine困惑不懂装懂);
2003-10-16
(#1416342@0)
-
everything is an object in .net,
-win(秋天的菠菜);
2003-10-16
(#1416351@0)
-
I know I asked a wrong question. I think what I want to say should be:I can run Car.Wheel.Gettype.Name=Wheel
But I cannot run in this way "Car.Wheel".Gettype.Name, (the result should be string, not what I want)
If I can get this string expression "Car.Wheel", should there be any way I can get Car.Wheel.Gettype.Name?
-lilyba(sunshine困惑不懂装懂);
2003-10-16
{255}
(#1416393@0)
-
Is Wheel a sub class of Class Car? if not, how can u use Car.Wheel.GetType....?
-luobutour(小萝卜头);
2003-10-16
(#1416499@0)
-
yes.
-lilyba(sunshine困惑不懂装懂);
2003-10-16
(#1416506@0)
-
use Type class
-guestagain(guest again);
2003-10-16
(#1417023@0)