Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I have a CLI/C++ interface that I want to examine via .NET Reflection. Here's the function signature in the source code:
class ClassA;
template<typename _Type> class ClassTempA;
public interface class Test : BaseFunc {
public:
ClassTempA<int>& SomeFunc2(ClassA inst) = 0;
Here's what the function looks like when examined in .NET Reflector:
unsafe ClassTempA<int>* modopt(IsImplicitlyDereferenced) SomeFunc2(ClassA inst);
Is there a way to get at the modopt attributes via .NET reflection, or do I have to use the Metadata
Unmanaged API?
You can get the modopt
and modreq
info from System.Reflection
by calling ParameterInfo::GetOptionalCustomModifiers()
and ParameterInfo::GetRequiredCustomModifiers()
, respectively. To illustrate with your types, see the following.
class ClassA;
template<typename _Type> class ClassTempA;
public interface class Test : BaseFunc {
public:
ClassTempA<int>& SomeFunc2(ClassA inst) = 0;
array<Type^>^ GetModifiers()
MethodInfo^ SomeFunc2 = Test::typeid->GetMethod("SomeFunc2");
return method->ReturnParameter->GetOptionalCustomModifiers();
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.