|
Este artigo foi traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. Mais informações.
|
Tradução
Original
|
Type.IsPrimitive Propriedade
.NET Framework 2.0
Assembly: mscorlib (em mscorlib. dll)
Valor da propriedade
Tipo: System.BooleanImplementa
_Type.IsPrimitiveusing 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); } } }
import System.*;
import System.Runtime.Remoting.Contexts.*;
public class MyContextBoundClass extends ContextBoundObject
{
public String myString = "This class demonstrates the IsContextful, "
+"IsMarshalByRef, and IsPrimitive properties.";
} //MyContextBoundClass
public class MyTypeDemoClass
{
public static void main(String[] args)
{
try {
// Determine whether the types can be hosted in a Context.
Console.WriteLine("The IsContextful property for the"
+" {0} type is {1}.", MyTypeDemoClass.class.ToType().get_Name(),
System.Convert.ToString(MyTypeDemoClass.class.ToType().
get_IsContextful()));
Console.WriteLine("The IsContextful property for the"
+" {0} type is {1}.", MyContextBoundClass.class.ToType().
get_Name(), System.Convert.ToString(MyContextBoundClass.class.
ToType().get_IsContextful()));
// Determine whether the types are marshalled by reference.
Console.WriteLine("The MarshalByRef property of {0} is {1}.",
MyTypeDemoClass.class.ToType().get_Name(),
System.Convert.ToString(MyTypeDemoClass.class.ToType().
get_IsMarshalByRef()));
Console.WriteLine("The MarshalByRef property of {0} is {1}.",
MyContextBoundClass.class.ToType().get_Name(),
System.Convert.ToString(MyContextBoundClass.class.ToType().
get_IsMarshalByRef()));
// Determine whether the types are primitive datatypes.
Console.WriteLine("Is {0} is a primitive data type? {1}.",
int.class.ToType().get_Name(),
System.Convert.ToString(int.class.ToType().get_IsPrimitive()));
Console.WriteLine("Is {0} a primitive data type? {1}.",
String.class.ToType().get_Name(),System.Convert.ToString(
String.class.ToType().get_IsPrimitive()));
}
catch (System.Exception e) {
Console.WriteLine("An exception occurred: " + e.get_Message());
}
} //main
} //MyTypeDemoClass