dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Runtime/Serialization


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Runtime/Serialization FormatterServices.cs, 1.7, 1.8
Date: Sun, 31 Aug 2003 20:35:34 -0400

Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Runtime/Serialization
In directory subversions:/tmp/cvs-serv28776/runtime/System/Runtime/Serialization

Modified Files:
        FormatterServices.cs 
Log Message:


Convert "GetSerializableMembers" into an internalcall so that
it is more efficient and can more easily get same-named fields
in parent classes.


Index: FormatterServices.cs
===================================================================
RCS file: 
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Runtime/Serialization/FormatterServices.cs,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** FormatterServices.cs        22 Aug 2003 03:44:55 -0000      1.7
--- FormatterServices.cs        1 Sep 2003 00:35:32 -0000       1.8
***************
*** 104,157 ****
                                        throw new ArgumentNullException("type");
                                }
! 
!                               // Fetch the property and field lists.
!                               FieldInfo[] fields = type.GetFields
!                                       (BindingFlags.Public | 
BindingFlags.NonPublic |
!                                        BindingFlags.Instance);
!                               PropertyInfo[] properties = type.GetProperties
!                                       (BindingFlags.Public | 
BindingFlags.NonPublic |
!                                        BindingFlags.Instance);
! 
!                               // Determine the size of the final array.
!                               int size = 0;
!                               int posn;
!                               for(posn = 0; posn < fields.Length; ++posn)
!                               {
!                                       if((fields[posn].Attributes &
!                                                       
FieldAttributes.NotSerialized) == 0)
!                                       {
!                                               ++size;
!                                       }
!                               }
!                               for(posn = 0; posn < properties.Length; ++posn)
                                {
!                                       if(properties[posn].CanRead &&
!                                          properties[posn].CanWrite)
!                                       {
!                                               ++size;
!                                       }
                                }
! 
!                               // Create the member array and populate it.
!                               MemberInfo[] members = new MemberInfo [size];
!                               size = 0;
!                               for(posn = 0; posn < fields.Length; ++posn)
!                               {
!                                       if((fields[posn].Attributes &
!                                                       
FieldAttributes.NotSerialized) == 0)
!                                       {
!                                               members[size++] = fields[posn];
!                                       }
!                               }
!                               for(posn = 0; posn < properties.Length; ++posn)
                                {
!                                       if(properties[posn].CanRead &&
!                                          properties[posn].CanWrite)
!                                       {
!                                               members[size++] = 
properties[posn];
!                                       }
                                }
-                               return members;
                        }
  
        // Get an assembly by name.
--- 104,121 ----
                                        throw new ArgumentNullException("type");
                                }
!                               else if(!(type is ClrType))
                                {
!                                       return new MemberInfo [0];
                                }
!                               else
                                {
!                                       return 
InternalGetSerializableMembers(type);
                                }
                        }
+ 
+       // Internal version of "GetSerializableMembers".
+       [MethodImpl(MethodImplOptions.InternalCall)]
+       extern private static MemberInfo[] InternalGetSerializableMembers
+                               (Type type);
  
        // Get an assembly by name.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]