Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Xml / System / Xml / Serialization / IndentedWriter.cs / 1 / IndentedWriter.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
//-----------------------------------------------------------------------------
namespace System.Xml.Serialization {
using System.IO;
///
///
/// This class will write to a stream and manage indentation.
///
internal class IndentedWriter {
TextWriter writer;
bool needIndent;
int indentLevel;
bool compact;
internal IndentedWriter(TextWriter writer, bool compact) {
this.writer = writer;
this.compact = compact;
}
internal int Indent {
get {
return indentLevel;
}
set {
indentLevel = value;
}
}
internal void Write(string s) {
if (needIndent) WriteIndent();
writer.Write(s);
}
internal void Write(char c) {
if (needIndent) WriteIndent();
writer.Write(c);
}
internal void WriteLine(string s) {
if (needIndent) WriteIndent();
writer.WriteLine(s);
needIndent = true;
}
internal void WriteLine() {
writer.WriteLine();
needIndent = true;
}
internal void WriteIndent() {
needIndent = false;
if (!compact) {
for (int i = 0; i < indentLevel; i++) {
writer.Write(" ");
}
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ProcessThread.cs
- MultipleViewPatternIdentifiers.cs
- ChildrenQuery.cs
- Command.cs
- DataTableMapping.cs
- BinaryCommonClasses.cs
- PersonalizationProviderHelper.cs
- FormsAuthenticationUserCollection.cs
- Brush.cs
- ListBoxItemAutomationPeer.cs
- IdentitySection.cs
- KerberosSecurityTokenProvider.cs
- OleCmdHelper.cs
- CodeSnippetExpression.cs
- DocumentViewer.cs
- DbDataAdapter.cs
- Version.cs
- DataGridViewSelectedRowCollection.cs
- UnsafeNativeMethodsCLR.cs
- LogicalTreeHelper.cs
- IisTraceWebEventProvider.cs
- HtmlTernaryTree.cs
- UnsafeNativeMethodsCLR.cs
- D3DImage.cs
- IconBitmapDecoder.cs
- HandlerFactoryWrapper.cs
- InputLanguageEventArgs.cs
- BitmapFrameDecode.cs
- DelegatedStream.cs
- TextParaLineResult.cs
- CompilerParameters.cs
- FrameworkElement.cs
- XPathCompileException.cs
- Vector3DKeyFrameCollection.cs
- TemplatePartAttribute.cs
- EmbeddedMailObjectsCollection.cs
- WebEvents.cs
- WmfPlaceableFileHeader.cs
- EventNotify.cs
- DatagridviewDisplayedBandsData.cs
- BaseDataList.cs
- InputReport.cs
- NullRuntimeConfig.cs
- DateBoldEvent.cs
- SspiSecurityToken.cs
- EntityProviderServices.cs
- ThreadInterruptedException.cs
- NumberEdit.cs
- ProcessHostConfigUtils.cs
- MenuAutoFormat.cs
- EncryptedKeyIdentifierClause.cs
- TextDpi.cs
- OleDbParameter.cs
- XmlLinkedNode.cs
- ByteConverter.cs
- RepeatInfo.cs
- SpellerError.cs
- CircleHotSpot.cs
- List.cs
- SoapHeaders.cs
- cookiecontainer.cs
- EncodingNLS.cs
- HtmlButton.cs
- KeyValuePairs.cs
- DataGridViewLayoutData.cs
- Journaling.cs
- UseManagedPresentationElement.cs
- ProxyWebPart.cs
- AllMembershipCondition.cs
- KnownTypes.cs
- PrintControllerWithStatusDialog.cs
- RichTextBox.cs
- TextCompositionManager.cs
- GradientSpreadMethodValidation.cs
- SecUtil.cs
- WmpBitmapDecoder.cs
- SignedPkcs7.cs
- SqlUtil.cs
- State.cs
- SqlDataSourceConnectionPanel.cs
- CompModSwitches.cs
- ItemAutomationPeer.cs
- FormatterConverter.cs
- CapabilitiesPattern.cs
- ApplicationFileParser.cs
- SqlAliaser.cs
- GroupLabel.cs
- ToolStripDropDownButton.cs
- DataTable.cs
- PersianCalendar.cs
- CollectionView.cs
- TextTreeTextElementNode.cs
- TypeGeneratedEventArgs.cs
- PlatformCulture.cs
- JsonServiceDocumentSerializer.cs
- StaticTextPointer.cs
- EditCommandColumn.cs
- DoubleCollection.cs
- RawContentTypeMapper.cs
- TextDecorations.cs