字段的 Type.AssemblyQualifiedName
有没有办法从 System.Reflection.FieldInfo
获取类似 Type.AssemblyQualifiedName
属性的内容,该属性区分字符串列表和字节列表?
FieldInfo.GetFullName() 方法不区分这两者,我需要能够获取字段的偏移量,并且仍然区分字符串列表和字节列表。
Is there a way to get something like the Type.AssemblyQualifiedName
property, which differentiates between a List of strings and a List of bytes, from a System.Reflection.FieldInfo
?
The FieldInfo.GetFullName()
method doesn't differentiate between the 2, and I need to be able to get the offset of a field, and still differentiate between List of strings and a List of bytes.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过查看
FieldInfo
对象的FieldType
属性来访问字段的类型。编辑
我纠正了。
Type.Name
不会执行您想要的操作。您可以按照您的建议使用Type.AssemblyQualifiedName
,也可以通过查看Type.GetGenericArguments()
的结果直接访问类型。You could access the field's type by looking at the
FieldType
property of yourFieldInfo
object.EDIT
I stand corrected.
Type.Name
will not do what you want. You could useType.AssemblyQualifiedName
as you suggest or you could access the types directly by looking at the result ofType.GetGenericArguments()
.