System.Diagnostics.TextWriterTraceListener.Dispose C# (CSharp) Method

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void
        protected override void Dispose(bool disposing) { }
        public override void Flush() { }

Usage Example

Esempio n. 1
0
        public void Test03()
        {
            string msg1, name;
            name = "MyXMLTraceWriter";
            string fileName = string.Format("{0}_3.xml", this.GetType().Name);

            //Testing ctor(Stream, string)
            //Scenario 3: Vanilla - Pass in a valid name and check with the Name property
            try
            {
                CommonUtilities.DeleteFile(fileName);
                _stream = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write);
                _textWriter = new TextWriterTraceListener(_stream, name);
                Assert.True(_textWriter.Name == name);
                msg1 = "HelloWorld";
                _textWriter.WriteLine(msg1);
                _textWriter.Dispose();

                Assert.True(CommonUtilities.TestListenerContent(new Type[] { typeof(TextWriterTraceListener) }, new string[] { fileName }, msg1));
            }
            finally
            {
                CommonUtilities.DeleteFile(fileName);
            }
        }
All Usage Examples Of System.Diagnostics.TextWriterTraceListener::Dispose