Click here to Skip to main content
15,878,748 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Pass a dynamic value in project 1 to the method in project 2, for example: var temp = new {d1 = 1, d2 = 2, d3 = 3};
Transmit temp for method in project 2: public static bool Ex(dynamic p), in project 2, result p {d1 = 1, d2 = 2, d3 = 3}, but p.d1 will fail.
help me!

What I have tried:

Project 1:
var temp = new {d1=1,d2=2,d3=3};
Project2.Ex(temp).
In Project 2:
public static bool Ex(dynamic p)
{
Result p {d1=1,d2=2,d3=3}, but p.d1 . . . will fail?
}
Posted
Updated 21-Mar-17 22:14pm
Comments
Tomas Takac 22-Mar-17 3:49am    
Should work. What is the exact code in your Ex method?
Karthik_Mahalingam 22-Mar-17 4:19am    
it works inside the same project but fails when called from other project.

1 solution

clearly explained here
Passing dynamic to class library [^]

action to be taken on
internal static bool Ex(dynamic p) // make it as internal 


in project 1 AssemblyInfo.cs
[assembly:InternalsVisibleTo("Project2DLLName")] 

in project 2 AssemblyInfo.cs
[assembly:InternalsVisibleTo("Project1DLLName")] 
 
Share this answer
 
v2
Comments
Tomas Takac 22-Mar-17 4:24am    
+5, interesting, didn't know this, cheers!
Karthik_Mahalingam 22-Mar-17 4:25am    
Thank you Tomas
kp564 22-Mar-17 4:47am    
May it solved by we service
Just try to create web service on server 1 and call it to server 2
TRAN VAN TAI 22-Mar-17 9:51am    
Thank you very much for your reply. But still not resolved my friend. I have loaded a simple program, thanks for your help.
https://drive.google.com/open?id=0B5maUXcnxxXOQmtMRFpNODhyYUE
TRAN VAN TAI 22-Mar-17 9:52am    
Thank you very much for your reply. But still not resolved my friend. I have loaded a simple program, thanks for your help.
https://drive.google.com/open?id=0B5maUXcnxxXOQmtMRFpNODhyYUE

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