本文整理汇总了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());
}