Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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.
//
// [....]
//-----------------------------------------------------------------------------
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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- X509CertificateCollection.cs
- SByte.cs
- OutKeywords.cs
- SourceFilter.cs
- ImageDrawing.cs
- CompilationUtil.cs
- ConnectionPoint.cs
- CompositeFontInfo.cs
- DataService.cs
- ButtonBaseAutomationPeer.cs
- Cursors.cs
- ISCIIEncoding.cs
- contentDescriptor.cs
- SimpleBitVector32.cs
- BuildManagerHost.cs
- EditorPart.cs
- UnmanagedBitmapWrapper.cs
- BitmapVisualManager.cs
- HandlerWithFactory.cs
- _OSSOCK.cs
- UpDownEvent.cs
- NonSerializedAttribute.cs
- SHA512.cs
- CheckBoxBaseAdapter.cs
- SystemUnicastIPAddressInformation.cs
- ConstraintCollection.cs
- DiscreteKeyFrames.cs
- UIPropertyMetadata.cs
- TextSelectionProcessor.cs
- TypeDescriptor.cs
- BooleanExpr.cs
- ObjectSet.cs
- Table.cs
- PolyBezierSegmentFigureLogic.cs
- ArgumentOutOfRangeException.cs
- RoutingUtilities.cs
- UnsafeNativeMethods.cs
- LocalizableAttribute.cs
- DataView.cs
- GestureRecognitionResult.cs
- Utils.cs
- RegisteredArrayDeclaration.cs
- XmlReaderSettings.cs
- RegexMatchCollection.cs
- ParameterBuilder.cs
- ContentType.cs
- VirtualizedItemProviderWrapper.cs
- SRGSCompiler.cs
- BmpBitmapEncoder.cs
- DocumentAutomationPeer.cs
- FilterElement.cs
- ACE.cs
- Pair.cs
- DataSetViewSchema.cs
- TemplatedWizardStep.cs
- Tablet.cs
- DrawTreeNodeEventArgs.cs
- MaskInputRejectedEventArgs.cs
- LinkedResourceCollection.cs
- ConnectionStringSettingsCollection.cs
- GridItemCollection.cs
- SqlDependencyListener.cs
- WindowsFormsHelpers.cs
- EntityClientCacheKey.cs
- ObjectListCommandsPage.cs
- AttributeEmitter.cs
- SqlTrackingWorkflowInstance.cs
- ObjectViewListener.cs
- XmlSchemaChoice.cs
- ScriptReference.cs
- EventWaitHandle.cs
- DBSqlParserColumnCollection.cs
- ParenthesizePropertyNameAttribute.cs
- WorkflowIdleElement.cs
- ExtensionSimplifierMarkupObject.cs
- TrustLevelCollection.cs
- EDesignUtil.cs
- XmlTextReaderImpl.cs
- RunClient.cs
- PropertyRecord.cs
- XslAstAnalyzer.cs
- DirectoryInfo.cs
- GraphicsContext.cs
- MethodRental.cs
- FrameworkElement.cs
- IntellisenseTextBox.designer.cs
- DataGridViewColumn.cs
- DesignerActionHeaderItem.cs
- Publisher.cs
- ChangePasswordDesigner.cs
- UntypedNullExpression.cs
- CodeDirectionExpression.cs
- StreamGeometry.cs
- TreeNodeBinding.cs
- AutomationAttributeInfo.cs
- ProcessProtocolHandler.cs
- HashCodeCombiner.cs
- VectorCollectionConverter.cs
- XmlSerializerAssemblyAttribute.cs
- _CommandStream.cs