当前位置: 首页>>代码示例>>C#>>正文


C# ISerializable.GetType方法代码示例

本文整理汇总了C#中ISerializable.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# ISerializable.GetType方法的具体用法?C# ISerializable.GetType怎么用?C# ISerializable.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISerializable的用法示例。


在下文中一共展示了ISerializable.GetType方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SurrogateForISerializable

 public SurrogateForISerializable(ISerializable serializable)
 {
     var serializationInfo = new SerializationInfo(serializable.GetType(), new FormatterConverter());
     var streamingContext = new StreamingContext(StreamingContextStates.Clone);
     serializable.GetObjectData(serializationInfo, streamingContext);
     keys = new string[serializationInfo.MemberCount];
     values = new object[serializationInfo.MemberCount];
     var i = 0;
     foreach(var entry in serializationInfo)
     {
         keys[i] = entry.Name;
         values[i] = entry.Value;
         i++;
     }
     assemblyQualifiedName = serializable.GetType().AssemblyQualifiedName;
 }
开发者ID:rogeralsing,项目名称:Migrant,代码行数:16,代码来源:SurrogateForISerializable.cs

示例2: SerializeISerializable

    private void SerializeISerializable(JsonWriter writer, ISerializable value, JsonISerializableContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
    {
      if (!JsonTypeReflector.FullyTrusted)
      {
        throw JsonSerializationException.Create(null, writer.ContainerPath, @"Type '{0}' implements ISerializable but cannot be serialized using the ISerializable interface because the current application is not fully trusted and ISerializable can expose secure data.
To fix this error either change the environment to be fully trusted, change the application to not deserialize the type, add JsonObjectAttribute to the type or change the JsonSerializer setting ContractResolver to use a new DefaultContractResolver with IgnoreSerializableInterface set to true.".FormatWith(CultureInfo.InvariantCulture, value.GetType()), null);
      }

      contract.InvokeOnSerializing(value, Serializer.Context);
      _serializeStack.Add(value);

      WriteObjectStart(writer, value, contract, member, collectionContract, containerProperty);

      SerializationInfo serializationInfo = new SerializationInfo(contract.UnderlyingType, new FormatterConverter());
      value.GetObjectData(serializationInfo, Serializer.Context);

      foreach (SerializationEntry serializationEntry in serializationInfo)
      {
        writer.WritePropertyName(serializationEntry.Name);
        SerializeValue(writer, serializationEntry.Value, GetContractSafe(serializationEntry.Value), null, null, member);
      }

      writer.WriteEndObject();

      _serializeStack.RemoveAt(_serializeStack.Count - 1);
      contract.InvokeOnSerialized(value, Serializer.Context);
    }
开发者ID:draptik,项目名称:RepoSync,代码行数:27,代码来源:JsonSerializerInternalWriter.cs

示例3: DoRopCall

        /// <summary>
        /// Send ROP request with single operation.
        /// </summary>
        /// <param name="ropRequest">ROP request objects.</param>
        /// <param name="insideObjHandle">Server object handle in request.</param>
        /// <param name="response">ROP response objects.</param>
        /// <param name="rawData">The ROP response payload.</param>
        /// <param name="getPropertiesFlag">The flag indicate the test cases expect to get which object type's properties(message's properties or attachment's properties).</param>
        /// <param name="returnValue">An unsigned integer value indicates the return value of call EcDoRpcExt2 method.</param>
        /// <returns>Server objects handles in response.</returns>
        public List<List<uint>> DoRopCall(ISerializable ropRequest, uint insideObjHandle, ref object response, ref byte[] rawData, GetPropertiesFlags getPropertiesFlag, out uint returnValue)
        {
            List<ISerializable> requestRops = new List<ISerializable>
            {
                ropRequest
            };

            List<uint> requestSOH = new List<uint>
            {
                insideObjHandle
            };

            if (Common.IsOutputHandleInRopRequest(ropRequest))
            {
                // Add an element for server output object handle, set default value to 0xFFFFFFFF
                requestSOH.Add(DefaultOutputHandle);
            }
            
            List<IDeserializable> responseRops = new List<IDeserializable>();
            List<List<uint>> responseSOHs = new List<List<uint>>();

            // 0x10008 specifies the maximum size of the rgbOut buffer to place in Response.
            uint ret = this.oxcropsClient.RopCall(requestRops, requestSOH, ref responseRops, ref responseSOHs, ref rawData, 0x10008);
            returnValue = ret;
            if (ret == OxcRpcErrorCode.ECRpcFormat)
            {
                this.Site.Assert.Fail("Error RPC Format");
            }

            if (ret != 0)
            {
                return responseSOHs;
            }

            if (responseRops != null)
            {
                if (responseRops.Count > 0)
                {
                    response = responseRops[0];
                }
            }
            else
            {
                response = null;
            }

            if (ropRequest.GetType() == typeof(RopReleaseRequest))
            {
                return responseSOHs;
            }

            byte ropId = (byte)BitConverter.ToInt16(ropRequest.Serialize(), 0);

            List<PropertyObj> pts = null;
            switch (ropId)
            {
                case (byte)RopId.RopOpenMessage:
                    RopOpenMessageResponse openMessageResponse = (RopOpenMessageResponse)response;

                    // This check is for the open specification expectation for a particular request with some valid input parameters.
                    if (openMessageResponse.ReturnValue == 0x00000000)
                    {
                        this.VerifyRopOpenMessageResponse(openMessageResponse);
                    }

                    break;

                case (byte)RopId.RopGetPropertiesSpecific:
                    // RopGetPropertiesSpecificRequest
                    pts = PropertyHelper.GetPropertyObjFromBuffer(((RopGetPropertiesSpecificRequest)ropRequest).PropertyTags, (RopGetPropertiesSpecificResponse)response);

                    foreach (PropertyObj pitem in pts)
                    {
                        // Verify capture code for MS-OXCMSG. 
                        this.VerifyMessageSyntaxDataType(pitem);
                    }

                    PropertyObj propertyObjPidTagSubjectPrefix = PropertyHelper.GetPropertyByName(pts, PropertyNames.PidTagSubjectPrefix);
                    PropertyObj propertyObjPidTagNormalizedSubject = PropertyHelper.GetPropertyByName(pts, PropertyNames.PidTagNormalizedSubject);

                    // Verify the message of PidTagSubjectPrefixAndPidTagNormalizedSubject
                    if (PropertyHelper.IsPropertyValid(propertyObjPidTagSubjectPrefix) || PropertyHelper.IsPropertyValid(propertyObjPidTagNormalizedSubject))
                    {
                        this.VerifyMessageSyntaxPidTagSubjectPrefixAndPidTagNormalizedSubject(propertyObjPidTagSubjectPrefix, propertyObjPidTagNormalizedSubject);
                    }

                    // Verify the requirements of PidTagAttachmentLinkId and PidTagAttachmentFlags.
                    PropertyObj pidTagAttachmentLinkId = PropertyHelper.GetPropertyByName(pts, PropertyNames.PidTagAttachmentLinkId);
                    if (PropertyHelper.IsPropertyValid(pidTagAttachmentLinkId))
                    {
//.........这里部分代码省略.........
开发者ID:OfficeDev,项目名称:Interop-TestSuites,代码行数:101,代码来源:MS-OXCMSGAdapter.cs

示例4: WriteJsonISerializable

        internal void WriteJsonISerializable(XmlWriterDelegator xmlWriter, ISerializable obj)
#endif
        {
            Type objType = obj.GetType();
            SerializationInfo serInfo = new SerializationInfo(objType, XmlObjectSerializer.FormatterConverter);
            GetObjectData(obj, serInfo, GetStreamingContext()); 
            if (DataContract.GetClrTypeFullName(objType) != serInfo.FullTypeName)
            {
                throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(SR.GetString(SR.ChangingFullTypeNameNotSupported, serInfo.FullTypeName, DataContract.GetClrTypeFullName(objType))));
            }
            else
            {
                base.WriteSerializationInfo(xmlWriter, objType, serInfo);
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:15,代码来源:XmlObjectSerializerWriteContextComplexJson.cs

示例5: ProcessSingleRopWithMutipleServerObjects

        /// <summary>
        /// Method which executes single ROP with multiple server objects.
        /// </summary>
        /// <param name="ropRequest">ROP request object.</param>
        /// <param name="insideObjHandle">Server object handles in request.</param>
        /// <param name="response">ROP response object.</param>
        /// <param name="rawData">The ROP response payload.</param>
        /// <param name="expectedRopResponseType">ROP response type expected.</param>
        /// <returns>Server objects handles in response.</returns>
        private List<List<uint>> ProcessSingleRopWithMutipleServerObjects(
            ISerializable ropRequest,
            List<uint> insideObjHandle,
            ref IDeserializable response,
            ref byte[] rawData,
            RopResponseType expectedRopResponseType)
        {
            List<ISerializable> requestRops = new List<ISerializable>
            {
                ropRequest
            };

            List<uint> requestSOH = new List<uint>();
            for (int i = 0; i < insideObjHandle.Count; i++)
            {
                requestSOH.Add(insideObjHandle[i]);
            }

            if (Common.IsOutputHandleInRopRequest(ropRequest))
            {
                // Add an element for server output object handle, set default value to 0xFFFFFFFF
                requestSOH.Add(DefaultOutputHandle);
            }

            List<IDeserializable> responseRops = new List<IDeserializable>();
            List<List<uint>> responseSOHs = new List<List<uint>>();

            uint ret = this.oxcropsClient.RopCall(requestRops, requestSOH, ref responseRops, ref responseSOHs, ref rawData, MaxRgbOut);
            this.Site.Assert.AreEqual<uint>(OxcRpcErrorCode.ECNone, ret, "ROP call should return 0 for success, actually it returns {0}", ret);
            if (responseRops != null)
            {
                if (responseRops.Count > 0)
                {
                    response = responseRops[0];
                }
            }
            else
            {
                response = null;
            }

            if (ropRequest is RopReleaseRequest)
            {
                return responseSOHs;
            }

            try
            {
                string resName = response.GetType().Name;

                // The word "Response" takes 8 length.
                string ropName = resName.Substring(0, resName.Length - 8);
                Type adapterType = typeof(MS_OXCPRPTAdapter);

                // Call capture code using reflection mechanism
                // The code followed is to construct the verify method name of capture code and then call this method through reflection.
                string verifyMethodName = string.Empty;
                if (expectedRopResponseType == RopResponseType.SuccessResponse)
                {
                    verifyMethodName = "Verify" + ropName + "SuccessResponse";
                }
                else if (expectedRopResponseType == RopResponseType.FailureResponse)
                {
                    verifyMethodName = "Verify" + ropName + "FailureResponse";
                }
                else if (expectedRopResponseType == RopResponseType.Response)
                {
                    verifyMethodName = "Verify" + ropName + "Response";
                }
                else if (expectedRopResponseType == RopResponseType.NullDestinationFailureResponse)
                {
                    verifyMethodName = "Verify" + ropName + "NullDestinationFailureResponse";
                }
                else if (expectedRopResponseType == RopResponseType.RedirectResponse)
                {
                    verifyMethodName = "Verify" + ropName + "RedirectResponse";
                }

                Type reqType = ropRequest.GetType();
                MethodInfo method = adapterType.GetMethod(verifyMethodName, BindingFlags.NonPublic | BindingFlags.Instance);
                if (method == null)
                {
                    if (expectedRopResponseType == RopResponseType.SuccessResponse || expectedRopResponseType == RopResponseType.FailureResponse)
                    {
                        verifyMethodName = "Verify" + ropName + "Response";
                        method = adapterType.GetMethod(verifyMethodName, BindingFlags.NonPublic | BindingFlags.Instance);
                    }
                }

                if (method != null)
                {
//.........这里部分代码省略.........
开发者ID:OfficeDev,项目名称:Interop-TestSuites,代码行数:101,代码来源:MS-OXCPRPTAdapter.cs

示例6: ProcessSingleRopWithMutipleServerObjects

        /// <summary>
        /// Method which executes single ROP with multiple server objects.
        /// </summary>
        /// <param name="ropRequest">ROP request object.</param>
        /// <param name="inputObjHandles">Server object handles in request.</param>
        /// <param name="response">ROP response object.</param>
        /// <param name="rawData">The ROP response payload.</param>
        /// <param name="expectedRopResponseType">ROP response type expected.</param>
        /// <returns>Server objects handles in response.</returns>
        public List<List<uint>> ProcessSingleRopWithMutipleServerObjects(
            ISerializable ropRequest,
            List<uint> inputObjHandles,
            ref IDeserializable response,
            ref byte[] rawData,
            RopResponseType expectedRopResponseType)
        {
            List<ISerializable> requestRops = new List<ISerializable>
            {
                ropRequest
            };

            List<uint> requestSOH = new List<uint>();
            for (int i = 0; i < inputObjHandles.Count; i++)
            {
                requestSOH.Add(inputObjHandles[i]);
            }

            if (Common.IsOutputHandleInRopRequest(ropRequest))
            {
                 // Add an element for server output object handle, set default value to 0xFFFFFFFF
                requestSOH.Add(DefaultOutputHandle);
            }

            List<IDeserializable> responseRops = new List<IDeserializable>();
            List<List<uint>> responseSOHs = new List<List<uint>>();

            uint ret = this.RopCall(requestRops, requestSOH, ref responseRops, ref responseSOHs, ref rawData, MaxRgbOut);
            if (ret != OxcRpcErrorCode.ECNone)
            {
                Site.Assert.AreEqual<RopResponseType>(RopResponseType.RPCError, expectedRopResponseType, "Unexpected RPC error {0} occurred.", ret);
                return responseSOHs;
            }

            if (responseRops != null)
            {
                if (responseRops.Count > 0)
                {
                    response = responseRops[0];
                }
            }
            else
            {
                response = null;
            }

            if (ropRequest.GetType() == typeof(RopReleaseRequest))
            {
                return responseSOHs;
            }

            try
            {
                this.VerifyAdapterCaptureCode(expectedRopResponseType, response, ropRequest);
            }
            catch (TargetInvocationException invocationEx)
            {
                Site.Log.Add(LogEntryKind.Debug, invocationEx.Message);
                if (invocationEx.InnerException != null)
                {
                    throw invocationEx.InnerException;
                }
            }
            catch (NullReferenceException nullEx)
            {
                Site.Log.Add(LogEntryKind.Debug, nullEx.Message);
            }

            return responseSOHs;
        }
开发者ID:ClareMSYanGit,项目名称:Interop-TestSuites,代码行数:79,代码来源:MS-OXCROPSAdapter.cs

示例7: VerifyAdapterCaptureCode

        /// <summary>
        /// Verify adapter capture code using reflection mechanism.
        /// </summary>
        /// <param name="expectedRopResponseType">The Expected ROP response type.</param>
        /// <param name="response">ROP response object.</param>
        /// <param name="ropRequest">ROP request object.</param>
        private void VerifyAdapterCaptureCode(RopResponseType expectedRopResponseType, IDeserializable response, ISerializable ropRequest)
        {
            string resName = response.GetType().Name;

            // The word "Response" takes 8 length.
            string ropName = resName.Substring(0, resName.Length - 8);
            Type adapterType = typeof(MS_OXCROPSAdapter);

            // Call capture code using reflection mechanism
            // The code followed is to construct the verify method name of capture code and then call this method through reflection.
            string verifyMethodName = string.Empty;
            if (expectedRopResponseType == RopResponseType.SuccessResponse)
            {
                verifyMethodName = "Verify" + ropName + "SuccessResponse";
            }
            else if (expectedRopResponseType == RopResponseType.FailureResponse)
            {
                verifyMethodName = "Verify" + ropName + "FailureResponse";
            }
            else if (expectedRopResponseType == RopResponseType.Response)
            {
                verifyMethodName = "Verify" + ropName + "Response";
            }
            else if (expectedRopResponseType == RopResponseType.NullDestinationFailureResponse)
            {
                verifyMethodName = "Verify" + ropName + "NullDestinationFailureResponse";
            }
            else if (expectedRopResponseType == RopResponseType.RedirectResponse)
            {
                verifyMethodName = "Verify" + ropName + "RedirectResponse";
            }

            Type reqType = ropRequest.GetType();
            MethodInfo method = adapterType.GetMethod(verifyMethodName, BindingFlags.NonPublic | BindingFlags.Instance);
            if (method == null)
            {
                if (expectedRopResponseType == RopResponseType.SuccessResponse || expectedRopResponseType == RopResponseType.FailureResponse)
                {
                    verifyMethodName = "Verify" + ropName + "Response";
                    method = adapterType.GetMethod(verifyMethodName, BindingFlags.NonPublic | BindingFlags.Instance);
                }
            }

            if (method != null)
            {
                ParameterInfo[] paraInfos = method.GetParameters();
                int paraNum = paraInfos.Length;
                object[] paraObjects = new object[paraNum];
                paraObjects[0] = response;
                for (int i = 1; i < paraNum; i++)
                {
                    FieldInfo fieldInReq = reqType.GetField(
                        paraInfos[i].Name,
                        BindingFlags.IgnoreCase
                        | BindingFlags.DeclaredOnly
                        | BindingFlags.Public
                        | BindingFlags.NonPublic
                        | BindingFlags.GetField
                        | BindingFlags.Instance);
                    paraObjects[i] = fieldInReq.GetValue(ropRequest);
                }

                method.Invoke(this, paraObjects);
            }
        }
开发者ID:ClareMSYanGit,项目名称:Interop-TestSuites,代码行数:71,代码来源:MS-OXCROPSAdapter.cs

示例8: ProcessSingleRopWithReturnValue

        /// <summary>
        /// Method which executes single ROP.
        /// </summary>
        /// <param name="ropRequest">ROP request objects.</param>
        /// <param name="inputObjHandle">Server object handle in request.</param>
        /// <param name="response">ROP response objects.</param>
        /// <param name="rawData">The ROP response payload.</param>
        /// <param name="expectedRopResponseType">ROP response type expected.</param>
        /// <param name="returnValue">The return value of the ROP method.</param>
        /// <returns>Server objects handles in response.</returns>
        public List<List<uint>> ProcessSingleRopWithReturnValue(
            ISerializable ropRequest,
            uint inputObjHandle,
            ref IDeserializable response,
            ref byte[] rawData,
            RopResponseType expectedRopResponseType,
            out uint returnValue)
        {
            List<ISerializable> requestRops = null;
            if (ropRequest != null)
            {
                requestRops = new List<ISerializable>
                {
                    ropRequest
                };
            }

            List<uint> requestSOH = new List<uint>
            {
                inputObjHandle
            };

            if (Common.IsOutputHandleInRopRequest(ropRequest))
            {
                // Add an element for server output object handle and set default value to 0xFFFFFFFF.
                requestSOH.Add(DefaultOutputHandle);
            }

            if (this.IsInvalidInputHandleNeeded(ropRequest, expectedRopResponseType))
            {
                // Add an invalid input handle in request and set its value to 0xFFFFFFFF.
                requestSOH.Add(InvalidInputHandle);
            }

            List<IDeserializable> responseRops = new List<IDeserializable>();
            List<List<uint>> responseSOHs = new List<List<uint>>();

            uint ret = this.RopCall(requestRops, requestSOH, ref responseRops, ref responseSOHs, ref rawData, MaxRgbOut);
            returnValue = ret;
            if (ret != OxcRpcErrorCode.ECNone && ret != 1726)
            {
                Site.Assert.AreEqual<RopResponseType>(RopResponseType.RPCError, expectedRopResponseType, "Unexpected RPC error {0} occurred.", ret);
                return responseSOHs;
            }

            if (responseRops != null)
            {
                if (responseRops.Count > 0)
                {
                    response = responseRops[0];
                }
            }
            else
            {
                response = null;
            }

            if (ropRequest.GetType() == typeof(RopReleaseRequest))
            {
                return responseSOHs;
            }

            if (response.GetType() == typeof(RopSaveChangesMessageResponse) && ((RopSaveChangesMessageResponse)response).ReturnValue == 0x80040401)
            {
                return responseSOHs;
            }

            if (response != null)
            {
                try
                {
                    this.VerifyAdapterCaptureCode(expectedRopResponseType, response, ropRequest);
                }
                catch (TargetInvocationException invocationEx)
                {
                    Site.Log.Add(LogEntryKind.Debug, invocationEx.Message);
                    if (invocationEx.InnerException != null)
                    {
                        throw invocationEx.InnerException;
                    }
                }
                catch (NullReferenceException nullEx)
                {
                    Site.Log.Add(LogEntryKind.Debug, nullEx.Message);
                }
            }

            return responseSOHs;
        }
开发者ID:ClareMSYanGit,项目名称:Interop-TestSuites,代码行数:99,代码来源:MS-OXCROPSAdapter.cs

示例9: serializeFromISerializable

        private void serializeFromISerializable(ISerializable data)
        {
            m_CustomData = new Dictionary<string,CustomTypedEntry>();

                    var info = new SerializationInfo(data.GetType(), new FormatterConverter());
                    StreamingContext streamingContext = new StreamingContext(StreamingContextStates.Persistence);
                    data.GetObjectData(info, streamingContext);

                    var senum = info.GetEnumerator();
                    while(senum.MoveNext())
                    {
                        var value = new CustomTypedEntry();
                        value.TypeIndex = MetaType.GetExistingOrNewMetaTypeIndex( m_Document, senum.ObjectType );
                        value.Data = m_Document.NativeDataToPortableData( senum.Value );
                        m_CustomData[senum.Name] = value;
                    }
        }
开发者ID:itadapter,项目名称:nfx,代码行数:17,代码来源:CompositeCustomData.cs

示例10: WriteJsonISerializable

 internal void WriteJsonISerializable(XmlWriterDelegator xmlWriter, ISerializable obj)
 {
     Type type = obj.GetType();
     SerializationInfo info = new SerializationInfo(type, XmlObjectSerializer.FormatterConverter);
     obj.GetObjectData(info, base.GetStreamingContext());
     if (DataContract.GetClrTypeFullName(type) != info.FullTypeName)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(System.Runtime.Serialization.SR.GetString("ChangingFullTypeNameNotSupported", new object[] { info.FullTypeName, DataContract.GetClrTypeFullName(type) })));
     }
     base.WriteSerializationInfo(xmlWriter, type, info);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:XmlObjectSerializerWriteContextComplexJson.cs

示例11: SerializeISerializable

 // Token: 0x06000C07 RID: 3079
 // RVA: 0x00047744 File Offset: 0x00045944
 private void SerializeISerializable(JsonWriter writer, ISerializable value, JsonISerializableContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
 {
     if (!JsonTypeReflector.FullyTrusted)
     {
         string text = "Type '{0}' implements ISerializable but cannot be serialized using the ISerializable interface because the current application is not fully trusted and ISerializable can expose secure data." + Environment.NewLine + "To fix this error either change the environment to be fully trusted, change the application to not deserialize the type, add JsonObjectAttribute to the type or change the JsonSerializer setting ContractResolver to use a new DefaultContractResolver with IgnoreSerializableInterface set to true." + Environment.NewLine;
         text = StringUtils.FormatWith(text, CultureInfo.InvariantCulture, value.GetType());
         throw JsonSerializationException.Create(null, writer.ContainerPath, text, null);
     }
     this.OnSerializing(writer, contract, value);
     this._serializeStack.Add(value);
     this.WriteObjectStart(writer, value, contract, member, collectionContract, containerProperty);
     SerializationInfo serializationInfo = new SerializationInfo(contract.UnderlyingType, new FormatterConverter());
     value.GetObjectData(serializationInfo, this.Serializer._context);
     SerializationInfoEnumerator enumerator = serializationInfo.GetEnumerator();
     while (enumerator.MoveNext())
     {
         SerializationEntry current = enumerator.Current;
         JsonContract contractSafe = this.GetContractSafe(current.Value);
         if (this.ShouldWriteReference(current.Value, null, contractSafe, contract, member))
         {
             writer.WritePropertyName(current.Name);
             this.WriteReference(writer, current.Value);
         }
         else if (this.CheckForCircularReference(writer, current.Value, null, contractSafe, contract, member))
         {
             writer.WritePropertyName(current.Name);
             this.SerializeValue(writer, current.Value, contractSafe, null, contract, member);
         }
     }
     writer.WriteEndObject();
     this._serializeStack.RemoveAt(this._serializeStack.Count - 1);
     this.OnSerialized(writer, contract, value);
 }
开发者ID:newchild,项目名称:Project-DayZero,代码行数:35,代码来源:JsonSerializerInternalWriter.cs

示例12: SendObject

 /// <summary>
 /// Sends the serializable object and autmatically determine the name.
 /// </summary>
 /// <param name="o">the object to send</param>
 public void SendObject(ISerializable o)
 {
     byte[] buffer = Serialize(o);
     string type = o.GetType().Name;
     Message message = PrepareMessage(type, buffer);
     send(message);
 }
开发者ID:0790486,项目名称:umundo,代码行数:11,代码来源:TypedPublisher.cs


注:本文中的ISerializable.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。