Any object outside the application domain of the caller application should be considered as Remote Object . A Remote Object that should be derived from MarshalByRefObject Class. Any object can be changed into a Remote Object by deriving it from MarshalByRefObject . Objects without inheriting from MarshalByRefObject are called Non-remotable Objects.
The following example creating a Remote Object in C#, RemoteTime , which send the current time to the Client Application using Remoting Framework. The RemoteTime class is derived from MarshalByRefObject and inside the class it has a method getTime() which returns the current time from the Remote Object.
using System;
public class RemoteTime : MarshalByRefObject
{
private string currentTime = "";
public string getTime()
{
currentTime = DateTime.Now.ToShortTimeString();
return "Remote Server Time : " + currentTime;
}
}csc /t:library RemoteTime.cs
csc /t:library c:\src\RemoteTime.cs