private void InitializeContract(JsonContract contract) { JsonContainerAttribute containerAttribute = JsonTypeReflector.GetJsonContainerAttribute(contract.UnderlyingType); if (containerAttribute != null) { contract.IsReference = containerAttribute._isReference; } #if !PocketPC && !SILVERLIGHT foreach (MethodInfo method in contract.UnderlyingType.GetMethods(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)) { Type prevAttributeType = null; ParameterInfo[] parameters = method.GetParameters(); if (IsValidCallback(method, parameters, typeof(OnSerializingAttribute), contract.OnSerializing, ref prevAttributeType)) { contract.OnSerializing = method; } if (IsValidCallback(method, parameters, typeof(OnSerializedAttribute), contract.OnSerialized, ref prevAttributeType)) { contract.OnSerialized = method; } if (IsValidCallback(method, parameters, typeof(OnDeserializingAttribute), contract.OnDeserializing, ref prevAttributeType)) { contract.OnDeserializing = method; } if (IsValidCallback(method, parameters, typeof(OnDeserializedAttribute), contract.OnDeserialized, ref prevAttributeType)) { contract.OnDeserialized = method; } } #endif }