Cet article a fait l'objet d'une traduction manuelle. Déplacez votre pointeur sur les phrases de l'article pour voir la version originale de ce texte. |
Traduction
Source
|
Type.IsMarshalByRef, propriété
Obtient une valeur indiquant si Type est marshalé par référence.
Assembly : mscorlib (dans mscorlib.dll)
L'exemple suivant illustre les propriétés IsContextful, IsMarshalByRef et IsPrimitive de la classe Type. Il vérifie si le type donné peut être hébergé dans le contexte, s'il peut être marshalé par référence et s'il s'agit d'un type de données primitif.
using System; using System.Runtime.Remoting.Contexts; public class MyContextBoundClass: ContextBoundObject { public string myString = "This class demonstrates the IsContextful, IsMarshalByRef, and IsPrimitive properties."; } public class MyTypeDemoClass { public static void Main() { try { // Determine whether the types can be hosted in a Context. Console.WriteLine ("The IsContextful property for the {0} type is {1}.", typeof(MyTypeDemoClass).Name, typeof(MyTypeDemoClass).IsContextful); Console.WriteLine ("The IsContextful property for the {0} type is {1}.", typeof(MyContextBoundClass).Name, typeof(MyContextBoundClass).IsContextful); // Determine whether the types are marshalled by reference. Console.WriteLine ("The MarshalByRef property of {0} is {1}.", typeof(MyTypeDemoClass).Name, typeof(MyTypeDemoClass).IsMarshalByRef); Console.WriteLine ("The MarshalByRef property of {0} is {1}.", typeof(MyContextBoundClass).Name, typeof(MyContextBoundClass).IsMarshalByRef); // Determine whether the types are primitive datatypes. Console.WriteLine ("Is {0} is a primitive data type? {1}.", typeof(int).Name, typeof(int).IsPrimitive); Console.WriteLine ("Is {0} a primitive data type? {1}.", typeof(string).Name, typeof(string).IsPrimitive); } catch (Exception e) { Console.WriteLine("An exception occurred: " + e.Message); } } }
Windows 7, Windows Vista SP1 ou ultérieur, Windows XP SP3, Windows XP SP2 Édition x64, Windows Server 2008 (installation minimale non prise en charge), Windows Server 2008 R2 (installation minimale prise en charge avec SP1 ou version ultérieure), Windows Server 2003 SP2
Le .NET Framework ne prend pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.