Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataWeb / Server / System / Data / Services / Serializers / TextSerializer.cs / 1305376 / TextSerializer.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // //// Provides a serializer for text content. // // // @owner [....] //--------------------------------------------------------------------- namespace System.Data.Services.Serializers { #region Namespaces. using System.Diagnostics; using System.IO; using System.Text; using System.Xml; #endregion Namespaces. ////// Provides support for serializing responses in text format. /// internal struct TextSerializer : IExceptionWriter { ///Writer to which output is sent. private readonly TextWriter writer; ///Initializes a new /// Stream to which output should be sent. /// Encoding to be used to write the result. internal TextSerializer(Stream output, Encoding encoding) { Debug.Assert(output != null, "output != null"); Debug.Assert(encoding != null, "encoding != null"); this.writer = new StreamWriter(output, encoding); } ///for the specified stream. Serializes exception information. /// Description of exception to serialize. public void WriteException(HandleExceptionArgs args) { XmlWriter xmlWriter = XmlWriter.Create(this.writer); ErrorHandler.SerializeXmlError(args, xmlWriter); this.writer.Flush(); } ///Handles the complete serialization for the specified content. /// Single Content to write.. ///internal void WriteRequest(object content) { Debug.Assert(content != null, "content != null"); string contentAsText; if (!System.Data.Services.Parsing.WebConvert.TryXmlPrimitiveToString(content, out contentAsText)) { throw new InvalidOperationException(Strings.Serializer_CannotConvertValue(content)); } Debug.Assert(contentAsText != null, "contentAsText != null"); this.writer.Write(contentAsText); this.writer.Flush(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. should be a byte array.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CFGGrammar.cs
- Emitter.cs
- ImageMetadata.cs
- Transform.cs
- RootProfilePropertySettingsCollection.cs
- EventBookmark.cs
- Soap12FormatExtensions.cs
- FormViewAutoFormat.cs
- CharAnimationUsingKeyFrames.cs
- EditorServiceContext.cs
- FontSource.cs
- AppDomainUnloadedException.cs
- Overlapped.cs
- GridViewDesigner.cs
- XmlnsPrefixAttribute.cs
- CompilerHelpers.cs
- MobileTemplatedControlDesigner.cs
- ReadOnlyKeyedCollection.cs
- SerializationInfo.cs
- WeakEventManager.cs
- x509store.cs
- DbMetaDataFactory.cs
- OperationAbortedException.cs
- TreeViewBindingsEditor.cs
- HttpPostedFile.cs
- RotationValidation.cs
- CodeAttachEventStatement.cs
- Invariant.cs
- ComponentSerializationService.cs
- SingleAnimation.cs
- hwndwrapper.cs
- VBIdentifierTrimConverter.cs
- Transaction.cs
- InputBinding.cs
- RangeValuePattern.cs
- PromptStyle.cs
- ExternalDataExchangeClient.cs
- TrackingMemoryStreamFactory.cs
- BaseParaClient.cs
- HtmlInputCheckBox.cs
- ClientScriptManager.cs
- ContentIterators.cs
- TimestampInformation.cs
- BufferBuilder.cs
- MonitoringDescriptionAttribute.cs
- SQLGuidStorage.cs
- SoapReflector.cs
- TemplatePropertyEntry.cs
- CollectionBase.cs
- TypedRowHandler.cs
- DelegateHelpers.cs
- UnsafeNativeMethods.cs
- SessionState.cs
- SerialReceived.cs
- ListChunk.cs
- Line.cs
- FileDialogPermission.cs
- MethodImplAttribute.cs
- InputLanguageEventArgs.cs
- DependsOnAttribute.cs
- CompilationSection.cs
- GridViewColumnHeader.cs
- Message.cs
- WebPartsPersonalization.cs
- ResourcesBuildProvider.cs
- Bold.cs
- DoubleKeyFrameCollection.cs
- LogRestartAreaEnumerator.cs
- OdbcDataReader.cs
- ScriptMethodAttribute.cs
- Buffer.cs
- TimerElapsedEvenArgs.cs
- ModelService.cs
- ActiveXHost.cs
- CoTaskMemSafeHandle.cs
- RootAction.cs
- X509WindowsSecurityToken.cs
- CommonDialog.cs
- LineBreakRecord.cs
- TranslateTransform.cs
- EdgeProfileValidation.cs
- MetadataItemSerializer.cs
- RijndaelManagedTransform.cs
- MimeMapping.cs
- SynchronizationLockException.cs
- DataGridParentRows.cs
- StylusSystemGestureEventArgs.cs
- TimeSpanParse.cs
- DBParameter.cs
- NetworkInformationException.cs
- PlanCompilerUtil.cs
- MetadataItemEmitter.cs
- CacheModeValueSerializer.cs
- BitmapImage.cs
- TraceRecord.cs
- RecognizedWordUnit.cs
- OleStrCAMarshaler.cs
- OrderedDictionaryStateHelper.cs
- RoleManagerEventArgs.cs
- SapiRecoInterop.cs