diff options
Diffstat (limited to 'src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs')
-rw-r--r-- | src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs b/src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs index 45521f2397..7fc3ce27d9 100644 --- a/src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs +++ b/src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs @@ -11,25 +11,25 @@ ** ** ===========================================================*/ -namespace System.Runtime.Serialization -{ - using System; - using System.Collections.Generic; - using System.Reflection; - using System.Runtime.Remoting; - using System.Globalization; - using System.Diagnostics; - using System.Diagnostics.Contracts; - using System.Security; - using System.Runtime.CompilerServices; +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Runtime.Remoting; +using System.Globalization; +using System.Diagnostics; +using System.Diagnostics.Contracts; +using System.Security; +using System.Runtime.CompilerServices; +namespace System.Runtime.Serialization +{ public sealed class SerializationInfo { private const int defaultSize = 4; private const string s_mscorlibAssemblySimpleName = System.CoreLib.Name; private const string s_mscorlibFileName = s_mscorlibAssemblySimpleName + ".dll"; - + // Even though we have a dictionary, we're still keeping all the arrays around for back-compat. // Otherwise we may run into potentially breaking behaviors like GetEnumerator() not returning entries in the same order they were added. internal String[] m_members; @@ -94,7 +94,7 @@ namespace System.Runtime.Serialization throw new ArgumentNullException(nameof(value)); } Contract.EndContractBlock(); - + m_fullTypeName = value; isFullTypeNameSetExplicit = true; } @@ -113,9 +113,9 @@ namespace System.Runtime.Serialization throw new ArgumentNullException(nameof(value)); } Contract.EndContractBlock(); - if (this.requireSameTokenInPartialTrust) + if (requireSameTokenInPartialTrust) { - DemandForUnsafeAssemblyNameAssignments(this.m_assemName, value); + DemandForUnsafeAssemblyNameAssignments(m_assemName, value); } m_assemName = value; isAssemblyNameSetExplicit = true; @@ -130,7 +130,7 @@ namespace System.Runtime.Serialization } Contract.EndContractBlock(); - if (this.requireSameTokenInPartialTrust) + if (requireSameTokenInPartialTrust) { DemandForUnsafeAssemblyNameAssignments(this.ObjectType.Assembly.FullName, type.Assembly.FullName); } @@ -331,7 +331,7 @@ namespace System.Runtime.Serialization if (m_nameToIndex.ContainsKey(name)) { BCLDebug.Trace("SER", "[SerializationInfo.AddValue]Tried to add ", name, " twice to the SI."); - throw new SerializationException(Environment.GetResourceString("Serialization_SameNameTwice")); + throw new SerializationException(SR.Serialization_SameNameTwice); } m_nameToIndex.Add(name, m_currMember); @@ -382,7 +382,6 @@ namespace System.Runtime.Serialization m_data[index] = value; m_types[index] = type; } - } private int FindElement(String name) @@ -416,7 +415,7 @@ namespace System.Runtime.Serialization int index = FindElement(name); if (index == -1) { - throw new SerializationException(Environment.GetResourceString("Serialization_NotFound", name)); + throw new SerializationException(SR.Format(SR.Serialization_NotFound, name)); } Debug.Assert(index < m_data.Length, "[SerializationInfo.GetElement]index<m_data.Length"); @@ -451,7 +450,6 @@ namespace System.Runtime.Serialization public Object GetValue(String name, Type type) { - if ((object)type == null) { throw new ArgumentNullException(nameof(type)); @@ -460,7 +458,7 @@ namespace System.Runtime.Serialization RuntimeType rt = type as RuntimeType; if (rt == null) - throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType")); + throw new ArgumentException(SR.Argument_MustBeRuntimeType); Type foundType; Object value; @@ -698,6 +696,5 @@ namespace System.Runtime.Serialization } return m_converter.ToString(value); } - } } |