本文整理匯總了C#中System.Runtime.Remoting.Services.ITrackingHandler.MarshaledObject方法的典型用法代碼示例。如果您正苦於以下問題:C# ITrackingHandler.MarshaledObject方法的具體用法?C# ITrackingHandler.MarshaledObject怎麽用?C# ITrackingHandler.MarshaledObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Runtime.Remoting.Services.ITrackingHandler
的用法示例。
在下文中一共展示了ITrackingHandler.MarshaledObject方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: MarshaledObject
// Called when the tracked object is marshaled.
[System.Security.Permissions.SecurityPermissionAttribute(
System.Security.Permissions.SecurityAction.LinkDemand,
Flags=System.Security.Permissions.SecurityPermissionFlag.Infrastructure)]
public void MarshaledObject(Object obj, ObjRef objRef)
{
// Notify the user of the marshal event.
Console.WriteLine("Tracking: An instance of {0} was marshaled.",
obj.ToString());
// Print the channel information.
if (objRef.ChannelInfo != null)
{
// Iterate over ChannelData.
foreach(object data in objRef.ChannelInfo.ChannelData)
{
if (data is ChannelDataStore)
{
// Print the URIs from the ChannelDataStore objects.
string[] uris = ((ChannelDataStore)data).ChannelUris;
foreach(string uri in uris)
Console.WriteLine("ChannelUri: " + uri);
}
}
}
// Print the envoy information.
if (objRef.EnvoyInfo != null)
Console.WriteLine("EnvoyInfo: " + objRef.EnvoyInfo.ToString());
// Print the type information.
if (objRef.TypeInfo != null)
{
Console.WriteLine("TypeInfo: " + objRef.TypeInfo.ToString());
Console.WriteLine("TypeName: " + objRef.TypeInfo.TypeName);
}
// Print the URI.
if (objRef.URI != null)
Console.WriteLine("URI: " + objRef.URI.ToString());
}