Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

referencing asp.net c# classes/methods in silverlight project

Does anyone know how to do this? I built a backend c# class in asp.net but want to access these same classes without recreating them in silverlight. Is this a possibility?

like image 652
locoboy Avatar asked Aug 24 '10 21:08

locoboy


1 Answers

You can reuse the cs files by adding them to your project AS LINK. Right click in your project and select Add Existing...Browse to your file and in the Open Button, use the pulldown arrow on the right to select Add As Link. You will see the file added to your project with an icon that with the little Windows Shortcut icon overlayed on it.

Just remember - the ASP.Net runs on the .Net runtime. Silverlight runs on the CoreCLR (Silverlight runtime.) Not everything that compiles in oone will compile in the other...

To separate things a little bit, #if directives can help, you can also use Partial Classes and partial methods (to add content that only runs on the server or on the client.)

like image 65
John Garland Avatar answered Nov 15 '22 04:11

John Garland