summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/Object.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mscorlib/src/System/Object.cs')
-rw-r--r--src/mscorlib/src/System/Object.cs48
1 files changed, 10 insertions, 38 deletions
diff --git a/src/mscorlib/src/System/Object.cs b/src/mscorlib/src/System/Object.cs
index 769c5a6bd6..d8d9a0e36c 100644
--- a/src/mscorlib/src/System/Object.cs
+++ b/src/mscorlib/src/System/Object.cs
@@ -12,7 +12,8 @@
**
===========================================================*/
-namespace System {
+namespace System
+{
using System;
using System.Runtime;
using System.Runtime.InteropServices;
@@ -23,9 +24,7 @@ namespace System {
using CultureInfo = System.Globalization.CultureInfo;
using FieldInfo = System.Reflection.FieldInfo;
using BindingFlags = System.Reflection.BindingFlags;
-#if FEATURE_REMOTING
- using RemotingException = System.Runtime.Remoting.RemotingException;
-#endif
+
// The Object is the root class for all object in the CLR System. Object
// is the super class for all other CLR objects and provide a set of methods and low level
// services to subclasses. These services include object synchronization and support for clone
@@ -96,7 +95,6 @@ public class Object
// Returns a Type object which represent this object instance.
//
- [System.Security.SecuritySafeCritical] // auto-generated
[Pure]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public extern Type GetType();
@@ -114,14 +112,12 @@ public class Object
// so that other object may only call this method on themselves. It is entended to
// support the ICloneable interface.
//
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
protected extern Object MemberwiseClone();
// Sets the value specified in the variant on the field
//
- [System.Security.SecurityCritical] // auto-generated
private void FieldSetter(String typeName, String fieldName, Object val)
{
Contract.Requires(typeName != null);
@@ -135,26 +131,21 @@ public class Object
// Make sure that the value is compatible with the type
// of field
-#if FEATURE_REMOTING
- System.Runtime.Remoting.Messaging.Message.CoerceArg(val, fldInfo.FieldType);
-#else
Type pt=fldInfo.FieldType;
if (pt.IsByRef)
{
pt = pt.GetElementType();
}
-
+
if (!pt.IsInstanceOfType(val))
{
val = Convert.ChangeType(val, pt, CultureInfo.InvariantCulture);
}
-#endif
-
- // Set the value
+ // Set the value
fldInfo.SetValue(this, val);
}
-
+
// Gets the value specified in the variant on the field
//
private void FieldGetter(String typeName, String fieldName, ref Object val)
@@ -166,7 +157,7 @@ public class Object
FieldInfo fldInfo = GetFieldInfo(typeName, fieldName);
// Get the value
- val = fldInfo.GetValue(this);
+ val = fldInfo.GetValue(this);
}
// Gets the field info object given the type name and field name.
@@ -190,13 +181,7 @@ public class Object
if (null == t)
{
-#if FEATURE_REMOTING
- throw new RemotingException(String.Format(
- CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_BadType"),
- typeName));
-#else
throw new ArgumentException();
-#endif
}
FieldInfo fldInfo = t.GetField(fieldName, BindingFlags.Public |
@@ -204,16 +189,9 @@ public class Object
BindingFlags.IgnoreCase);
if(null == fldInfo)
{
-#if FEATURE_REMOTING
- throw new RemotingException(String.Format(
- CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_BadField"),
- fieldName, typeName));
-#else
throw new ArgumentException();
-#endif
-
}
-
+
return fldInfo;
}
}
@@ -233,22 +211,16 @@ internal class __Canon
// This class is used to define the name of the base class library
internal class CoreLib
{
-
-#if FEATURE_CORECLR
public const string Name = "System.Private.CoreLib";
-#else
- public const string Name = "mscorlib";
-#endif
public static string FixupCoreLibName(string strToFixup)
{
-#if FEATURE_CORECLR
if (!String.IsNullOrEmpty(strToFixup))
{
strToFixup = strToFixup.Replace("mscorlib", System.CoreLib.Name);
}
-#endif
- return strToFixup;
+
+ return strToFixup;
}
}