Skip to content

Instantly share code, notes, and snippets.

@andyedinborough
Created April 1, 2010 22:19
Show Gist options
  • Save andyedinborough/352441 to your computer and use it in GitHub Desktop.
Save andyedinborough/352441 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Remoting_Test {
class Program {
static void Main(string[] args) {
AE.Remoting.Settings.Current.RemotingHost = "localhost";
using (new AE.Remoting.Service()) { // In this case, we're acting as the host
double x = 2;
double y = 3;
double z = 0;
//Example of an anonymous method and maintaining context
AE.Remoting.Utilities.Remote(() => {
z = Math.Pow(x, y);
});
Console.WriteLine(z);
//Example of an anonymous type
var result = AE.Remoting.Utilities.Remote(() => new { x =x, y= y, answer = Math.Pow(x,y) });
Console.WriteLine(result.answer);
//Example of maintaining the context
Customer customer = new Customer();
AE.Remoting.Utilities.Remote(customer.Save);
Console.WriteLine(customer.ID);
}
Console.ReadLine();
}
public class Customer {
public Guid ID { get; private set; }
public void Save() {
ID = Guid.NewGuid();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment