Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / 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
- EastAsianLunisolarCalendar.cs
- SSmlParser.cs
- GenericIdentity.cs
- StyleTypedPropertyAttribute.cs
- UnsafeNativeMethods.cs
- FloatAverageAggregationOperator.cs
- Console.cs
- ConnectionManagementSection.cs
- ActivityDesignerResources.cs
- UserControl.cs
- DataGridViewButtonCell.cs
- SafeRightsManagementHandle.cs
- QuaternionAnimationUsingKeyFrames.cs
- ZipIOBlockManager.cs
- PrimarySelectionGlyph.cs
- TagMapInfo.cs
- TypeInitializationException.cs
- AttributeUsageAttribute.cs
- LocalBuilder.cs
- safex509handles.cs
- Not.cs
- DbProviderFactoriesConfigurationHandler.cs
- TreeSet.cs
- SessionStateItemCollection.cs
- DataGridViewRowStateChangedEventArgs.cs
- RuleRefElement.cs
- GridViewCancelEditEventArgs.cs
- SignatureSummaryDialog.cs
- TypeGeneratedEventArgs.cs
- ArraySortHelper.cs
- XmlSchemaObjectTable.cs
- WebServiceHandler.cs
- DependencyObjectProvider.cs
- PermissionListSet.cs
- StateInitializationDesigner.cs
- AppDomainUnloadedException.cs
- UndoEngine.cs
- IsolatedStorage.cs
- ADConnectionHelper.cs
- MetabaseServerConfig.cs
- NativeRecognizer.cs
- Object.cs
- HtmlTableCell.cs
- WriteStateInfoBase.cs
- HGlobalSafeHandle.cs
- BasicHttpMessageSecurityElement.cs
- ResourceType.cs
- UnknownBitmapDecoder.cs
- PtsHost.cs
- Decoder.cs
- SystemIPv4InterfaceProperties.cs
- SqlCacheDependency.cs
- EventProxy.cs
- path.cs
- AnnotationHelper.cs
- XmlSerializer.cs
- NavigatorOutput.cs
- ProvideValueServiceProvider.cs
- AutoResetEvent.cs
- TypeValidationEventArgs.cs
- InstalledVoice.cs
- Operand.cs
- LinkLabel.cs
- EnumerableCollectionView.cs
- CachedBitmap.cs
- PublisherIdentityPermission.cs
- SyndicationElementExtensionCollection.cs
- SplineKeyFrames.cs
- TargetParameterCountException.cs
- Internal.cs
- SqlBulkCopyColumnMapping.cs
- WebMessageFormatHelper.cs
- Highlights.cs
- EditorBrowsableAttribute.cs
- ProjectedWrapper.cs
- UrlAuthFailureHandler.cs
- RelationshipEnd.cs
- GifBitmapDecoder.cs
- AsyncOperationManager.cs
- DataBindingCollectionEditor.cs
- CanExecuteRoutedEventArgs.cs
- connectionpool.cs
- HiddenFieldPageStatePersister.cs
- Tokenizer.cs
- PassportIdentity.cs
- PropertyDescriptorCollection.cs
- NonClientArea.cs
- AsnEncodedData.cs
- LZCodec.cs
- PkcsUtils.cs
- ToolboxItemAttribute.cs
- InkCanvasSelection.cs
- ObjectPersistData.cs
- MulticastNotSupportedException.cs
- Parsers.cs
- FilterQuery.cs
- UiaCoreProviderApi.cs
- DataSourceDesigner.cs
- RewritingValidator.cs
- PropertyMetadata.cs