using System.Collections;
using System.Reflection;
using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
using System.Runtime.Serialization.Formatters;
using System.Globalization;
namespace System.Runtime.Serialization
{
-#if NET_2_0
[System.Runtime.InteropServices.ComVisibleAttribute (true)]
-#endif
- public sealed class FormatterServices
+ static
+ public class FormatterServices
{
private const BindingFlags fieldFlags = BindingFlags.Public |
BindingFlags.Instance |
BindingFlags.NonPublic |
BindingFlags.DeclaredOnly;
- private FormatterServices ()
- {
- }
public static object [] GetObjectData (object obj, MemberInfo [] members)
{
foreach (FieldInfo field in fs)
if (!(field.IsNotSerialized)) {
MonoField mf = field as MonoField;
- if (mf != null) {
- string fname = (reflectedType != type && !mf.IsPublic) ? type.Name + "+" + mf.Name : mf.Name;
+ if (mf != null && reflectedType != type && !mf.IsPublic) {
+ string fname = type.Name + "+" + mf.Name;
fields.Add (mf.Clone (fname));
}
else
return obj;
}
-#if NET_1_1
public static void CheckTypeSecurity (Type t, TypeFilterLevel securityLevel)
{
return GetUninitializedObject (type);
}
-#endif
+
+ // This method was introduced in .Net due to a bug serializing objects with circular references
+ // which we don't appear to have, so we just return the same object.
+ // See http://support.microsoft.com/kb/927495/en-us/ in case of doubt.
+ [ComVisible (false)]
+ public static ISerializationSurrogate GetSurrogateForCyclicalReference (ISerializationSurrogate innerSurrogate)
+ {
+ return innerSurrogate;
+ }
}
}