Serialize() public method

public Serialize ( BinaryWriter writer, object instance ) : void
writer System.IO.BinaryWriter
instance object
return void
		public void FixtureSetUp()
		{
			FastSerializer serializer = new FastSerializer();
			using (MemoryStream ms = new MemoryStream()) {
				serializer.Serialize(ms, TypeSystemConvertVisitorTests.ParseTestCase());
				ms.Position = 0;
				testCasePC = (IProjectContent)serializer.Deserialize(ms);
			}
		}
		public void FixtureSetUp()
		{
			CecilLoader loader = new CecilLoader() { IncludeInternalMembers = true };
			IProjectContent pc = loader.LoadAssemblyFile(typeof(TestCase.SimplePublicClass).Assembly.Location);
			FastSerializer serializer = new FastSerializer();
			using (MemoryStream ms = new MemoryStream()) {
				serializer.Serialize(ms, pc);
				ms.Position = 0;
				testCasePC = (IProjectContent)serializer.Deserialize(ms);
			}
		}
		public void FixtureSetUp()
		{
			IkvmLoader loader = new IkvmLoader() { IncludeInternalMembers = true };
			IUnresolvedAssembly pc = loader.LoadAssemblyFile(typeof(TestCase.SimplePublicClass).Assembly.Location);
			FastSerializer serializer = new FastSerializer();
			using (MemoryStream ms = new MemoryStream()) {
				serializer.Serialize(ms, pc);
				ms.Position = 0;
				var asm = (IUnresolvedAssembly)serializer.Deserialize(ms);
				base.compilation = new SimpleCompilation(asm, IkvmLoaderTests.Mscorlib);
			}
		}
 void SaveToCache(string cacheFileName, DateTime lastWriteTime, LoadedAssembly asm)
 {
     if (cacheFileName == null)
         return;
     LoggingService.Debug("Serializing to " + cacheFileName);
     try {
         Directory.CreateDirectory(DomPersistencePath);
         using (FileStream fs = new FileStream(cacheFileName, FileMode.Create, FileAccess.Write)) {
             using (BinaryWriter writer = new BinaryWriterWith7BitEncodedInts(fs)) {
                 writer.Write(lastWriteTime.Ticks);
                 FastSerializer s = new FastSerializer();
                 s.Serialize(writer, asm);
             }
         }
     } catch (IOException ex) {
         LoggingService.Warn(ex);
         // Can happen if two SD instances are trying to access the file at the same time.
         // We'll just let one of them win, and instance that got the exception won't write to the cache at all.
         // Similarly, we also ignore the other kinds of IO exceptions.
     } catch (UnauthorizedAccessException ex) {
         LoggingService.Warn(ex);
     }
 }
		static void SaveToCache(string cacheFileName, IProjectContent pc)
		{
			try {
				Directory.CreateDirectory(Path.GetDirectoryName(cacheFileName));
				using (FileStream fs = new FileStream(cacheFileName, FileMode.Create, FileAccess.Write)) {
					using (BinaryWriter writer = new BinaryWriterWith7BitEncodedInts(fs)) {
						writer.Write(cacheMagicNumber);
						FastSerializer s = new FastSerializer();
						s.Serialize(writer, pc);
					}
				}
			} catch (IOException ex) {
				LoggingService.Warn(ex);
				// Can happen if two SD instances are trying to access the file at the same time.
				// We'll just let one of them win, and instance that got the exception won't write to the cache at all.
				// Similarly, we also ignore the other kinds of IO exceptions.
			} catch (UnauthorizedAccessException ex) {
				LoggingService.Warn(ex);
			}
		}