public void TestCase ()
		{
			var theData = new TheData (){ ABool = true, AChar = 'A', ADouble = 2, AnInt = 33 };

			var aFileName = BinaryReaderWriterExample.WriteData(theData);
			var thisData = BinaryReaderWriterExample.Readata (aFileName);

			Assert.AreEqual (theData, thisData);
		}
		public void TestCase ()
		{
			var theData = new TheData (){ ABool = true, AChar = 'A', ADouble = 2, AnInt = 33 };

			var aFilePath = StreamReaderWriterExample.WriteData (theData);
			var aOutStrings = StreamReaderWriterExample.ReadData (aFilePath);

			Assert.AreEqual (theData.ABool.ToString (), aOutStrings [0]);
			Assert.AreEqual (theData.AChar.ToString (), aOutStrings [1]);
			Assert.AreEqual (theData.ADouble.ToString (), aOutStrings [2]);
			Assert.AreEqual (theData.AnInt.ToString (), aOutStrings [3]);
		}
        public static TheData Readata(string fileName)
        {
            var theData = new TheData();

            using (var fs = new FileStream(fileName, FileMode.Open)) {
                using (var br = new BinaryReader(fs)) {
                    theData.ABool   = br.ReadBoolean();
                    theData.AChar   = br.ReadChar();
                    theData.ADouble = br.ReadDouble();
                    theData.AnInt   = br.ReadInt32();
                }

                return(theData);
            }
        }
        public static string WriteData(TheData theData)
        {
            var aFileName = Path.GetTempFileName();

            using (var fs = new FileStream(aFileName, FileMode.Create)) {
                using (var bw = new BinaryWriter(fs)) {
                    bw.Write(theData.ABool);
                    bw.Write(theData.AChar);
                    bw.Write(theData.ADouble);
                    bw.Write(theData.AnInt);
                }

                return(aFileName);
            }
        }
        public static string WriteData(TheData theData)
        {
            var aFilePath = Path.GetTempFileName();

            using (var fs = new FileStream(aFilePath, FileMode.OpenOrCreate)) {
                using (var writer = new StreamWriter(fs)) {
                    writer.WriteLine(theData.ABool);
                    writer.WriteLine(theData.AChar);
                    writer.WriteLine(theData.ADouble);
                    writer.WriteLine(theData.AnInt);
                }
            }

            return(aFilePath);
        }
		public static TheData Readata (string fileName)
		{
			var theData = new TheData ();

			using (var fs = new FileStream (fileName, FileMode.Open)) {
				using (var br = new BinaryReader (fs)) { 
				
					theData.ABool = br.ReadBoolean ();
					theData.AChar = br.ReadChar ();
					theData.ADouble = br.ReadDouble ();
					theData.AnInt = br.ReadInt32 ();
				}

				return theData;
			} 
		}
		public static string WriteData (TheData theData)
		{
			var aFileName = Path.GetTempFileName ();

			using (var fs = new FileStream (aFileName, FileMode.Create)) {
				using (var bw = new BinaryWriter (fs)) { 

					bw.Write (theData.ABool);
					bw.Write (theData.AChar);
					bw.Write (theData.ADouble);
					bw.Write (theData.AnInt);
				}

				return aFileName;
			} 
		}
		public static string WriteData (TheData theData)
		{
			var aFilePath = Path.GetTempFileName ();

			using (var fs = new FileStream (aFilePath, FileMode.OpenOrCreate)) {
				using (var writer = new StreamWriter (fs)) {

					writer.WriteLine (theData.ABool); 
					writer.WriteLine (theData.AChar);
					writer.WriteLine (theData.ADouble);  
					writer.WriteLine (theData.AnInt); 
				}
			} 

			return aFilePath;
		}