在运行时确定对象的全名。 [英] Determine full name of an object at runtime.

查看:72
本文介绍了在运行时确定对象的全名。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在运行时确定对象的全名?例如,如果我有以下


命名空间MyNameSpac

公共类MyClas

受保护的MyObject As Object''这可能是任何类型

结束Clas

结束Namespac


然后我想要一个能返回字符串的函数,RootNamespace.MyNameSpace .MyClass.MyObject"如果我将MyObject传递给函数,其中RootNamespace是项目的根命名空间


感谢您的帮助

Lanc

Is there any way to determine the full name of an object at runtime? For example, if I have the following

Namespace MyNameSpac
Public Class MyClas
Protected MyObject As Object ''This could be any type
End Clas
End Namespac

then I want a function that would return the string, "RootNamespace.MyNameSpace.MyClass.MyObject" if I passed MyObject to the function, where RootNamespace is the root namespace for the project

Thanks for any help
Lanc

推荐答案

" Lance" <滋*** @ hotmail.com> schrieb
"Lance" <zi***@hotmail.com> schrieb
有没有办法在运行时确定对象的全名?
例如,如果我有以下内容:

命名空间MyNameSpace 公共类MyClass
受保护的MyObject As Object''这可以是任何类型。
结束类
结束命名空间

然后我想要一个会返回字符串的函数,
" RootNamespace.MyNameSpace.MyClass.MyObject"如果我将MyObject传递给
函数,其中RootNamespace是
项目的根名称空间。
Is there any way to determine the full name of an object at runtime?
For example, if I have the following:

Namespace MyNameSpace
Public Class MyClass
Protected MyObject As Object ''This could be any type.
End Class
End Namespace

then I want a function that would return the string,
"RootNamespace.MyNameSpace.MyClass.MyObject" if I passed MyObject to
the function, where RootNamespace is the root namespace for the
project.




这是不可能的。如果传递对函数的引用,则函数

无法知道引用的存储位置。即使你传递了ByRef,

函数也不知道哪个对象以及

引用变量属于哪个类和命名空间。 />

你的意图是什么?我相信我们会找到解决方案。


-

Armin


如何引用及原因:
http://www.plig.net/ nnq / nquote.html
http:// www .netmeister.org / news / learn2quote.html


" Lance" <滋*** @ hotmail.com> schrieb
"Lance" <zi***@hotmail.com> schrieb
有没有办法在运行时确定对象的全名?
例如,如果我有以下内容:

命名空间MyNameSpace 公共类MyClass
受保护的MyObject As Object''这可以是任何类型。
结束类
结束命名空间

然后我想要一个会返回字符串的函数,
" RootNamespace.MyNameSpace.MyClass.MyObject"如果我将MyObject传递给
函数,其中RootNamespace是
项目的根名称空间。
Is there any way to determine the full name of an object at runtime?
For example, if I have the following:

Namespace MyNameSpace
Public Class MyClass
Protected MyObject As Object ''This could be any type.
End Class
End Namespace

then I want a function that would return the string,
"RootNamespace.MyNameSpace.MyClass.MyObject" if I passed MyObject to
the function, where RootNamespace is the root namespace for the
project.




这是不可能的。如果传递对函数的引用,则函数

无法知道引用的存储位置。即使你传递了ByRef,

函数也不知道哪个对象以及

引用变量属于哪个类和命名空间。 />

你的意图是什么?我相信我们会找到解决方案。


-

Armin


如何引用及原因:
http://www.plig.net/ nnq / nquote.html
http:// www .netmeister.org / news / learn2quote.html


感谢您的信息
Thanks for the info
什么是你的意向?我相信我们会找到一个解决方案
What''s your intention? I''m sure we''ll find a solution




拥有这个功能可以让我自动化我的应用程序的一部分,但实现一个解决方案不是困难


再次感谢您的帮助

Lance



Having this feature would have allowed me to automate a part of my app, but implementing a work around is not difficult

Thanks again for your help
Lance


这篇关于在运行时确定对象的全名。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆