Corey_819
asked on
Interface Get Property Values
Hello and I am sure I am missing something. I have implemented an interface from third party assembly and I want to know the Interface property values before I either change them or do anything else I just want to know their values. I implemented the interface and did a get on one of the properties but all the values are blank. Am I missing something, do I need reflections to do something like this? Thanks
C
C
ASKER
I thought so as well okay here you go I really must be missing something.
class Program : IComUserIdentity
{
static void Main(string[] args)
{
IComUserIdentity SCMUser = new Program();
System.Console.WriteLine("User Name: " + SCMUser.Context);
}
}
private String m_Context;
private int m_DirType;
String IComUserIdentity.Context
{
get { return m_Context; }
set { m_Context = value; }
}
int IComUserIdentity.DirType
{
get { return m_DirType; }
set { m_DirType = value; }
}
have you set a debug.breakpoint on each of the properties, and added a watch for each of the properties, so that you can see their default values at run time?
based purely on the datatypes the
String IComUserIdentity.Context should default to null or string.Empty and the
int IComUserIdentity.DirType should default to 0
based purely on the datatypes the
String IComUserIdentity.Context should default to null or string.Empty and the
int IComUserIdentity.DirType should default to 0
ASKER
Tarigpahmed and yeah based on the dataTypes this is excatly what keeps returning as values.
so, I am assuming that these values are not being set during the Third Party Class or app. I will put on the breakpoints and watch the values during runtime and find out if these values are event being populated.
so, I am assuming that these values are not being set during the Third Party Class or app. I will put on the breakpoints and watch the values during runtime and find out if these values are event being populated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Implementing the IComUserIdentity does nothing with the properties values. The typical usage would be to pass an instance of the class Program to someone that know how to handle IComUserIdentity.
Your class just create two variables (m_Context and m_DirType) and never assign a value to them so you will always get Nothing and 0.
As I said, implementing IComUserIdentity will never put a value on those variables (how would it be?)
Feel free to ask more if you need.
Your class just create two variables (m_Context and m_DirType) and never assign a value to them so you will always get Nothing and 0.
As I said, implementing IComUserIdentity will never put a value on those variables (how would it be?)
Feel free to ask more if you need.
ASKER
Thank you this makes sense.
Can you paste some code in so we can work with it? :)
Thanks,
-w00te