CSLA.NET 5.4.2
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
ObjectCloner.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="ObjectCloner.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>This class provides an implementation of a deep</summary>
7//-----------------------------------------------------------------------
9using System;
10using System.IO;
11
12namespace Csla.Core
13{
19 public static class ObjectCloner
20 {
40 public static object Clone(object obj)
41 {
42 using (MemoryStream buffer = new MemoryStream())
43 {
44 ISerializationFormatter formatter =
45 SerializationFormatterFactory.GetFormatter();
46 formatter.Serialize(buffer, obj);
47 buffer.Position = 0;
48 object temp = formatter.Deserialize(buffer);
49 return temp;
50 }
51 }
52 }
53}
Defines an object that can serialize and deserialize object graphs.
void Serialize(System.IO.Stream serializationStream, object graph)
Converts an object graph into a byte stream.
object Deserialize(System.IO.Stream serializationStream)
Converts a serialization stream into an object graph.