Click here to Skip to main content
15,895,841 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All, I am having trouble in a function of signature
C#
void event(ref string BusinessObjectInfo, out bool BubbleEvent)
       {

I want to use value of BubbleEvent inside the function using reflection. Can you suggest How should I go for it.
I have tried following
var v = MethodBase.GetCurrentMethod().GetParameters().GetValue(1)
but still in trouble don't know where to get the value.

Thank you for help
Posted
Comments
Kornfeld Eliyahu Peter 12-Feb-15 10:31am    
It makes no sense? Why should one access a parameter from inside the function by reflection?

As Peter says, it doesn't make a lot of sense: "Why should one access a parameter from inside the function by reflection?"
Particularly when it is an out parameter, as it has no value other than that which you give it in the actual method...

I can't hep thinking that perhaps you are trying to do something in entirely the wrong way, and should possibly take a step back and think again.
 
Share this answer
 
Comments
J imran 12-Feb-15 10:48am    
Dear I can see the value of BubbleEvent using quick watch. I am wondering why can't I get its value. Actually I am to check whether sap has already changed the value of BubbleEvent or not. I really need to do it this way because other way will cost me a lot of coding.
CHill60 12-Feb-15 11:29am    
You can't guarantee it will have a value so you shouldn't try to use it - as OG says, take a step back. You are supposed to set a value to BubbleEvent in your function which will be passed back to the caller. If the coder that supplied the function signature defined it as "out" then they mean "out" not "in and out" - either that or you need to talk to them about changing their code
The parameter is defined as out which means it does not need to be initialised by the calling method - you are supposed to assign it a value within your function.

If you want to pass a value in, change it and pass it back out use ref instead of out
 
Share this answer
 
Comments
J imran 12-Feb-15 10:51am    
actually I am using a library where the coder has provided me with the function signature already. I am to work a lot for finding another way arround.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900