Click here to Skip to main content
16,016,882 members
Home / Discussions / C#
   

C#

 
QuestionObject Serialization with an ArrayList Pin
Spyder_Snyper6-Aug-07 6:25
Spyder_Snyper6-Aug-07 6:25 
AnswerRe: Object Serialization with an ArrayList Pin
Hessam Jalali6-Aug-07 8:38
Hessam Jalali6-Aug-07 8:38 
GeneralRe: Object Serialization with an ArrayList Pin
Spyder_Snyper6-Aug-07 8:57
Spyder_Snyper6-Aug-07 8:57 
GeneralRe: Object Serialization with an ArrayList Pin
Hessam Jalali6-Aug-07 9:20
Hessam Jalali6-Aug-07 9:20 
GeneralRe: Object Serialization with an ArrayList Pin
Spyder_Snyper6-Aug-07 9:23
Spyder_Snyper6-Aug-07 9:23 
GeneralRe: Object Serialization with an ArrayList Pin
Hessam Jalali6-Aug-07 9:34
Hessam Jalali6-Aug-07 9:34 
GeneralRe: Object Serialization with an ArrayList Pin
Spyder_Snyper6-Aug-07 9:43
Spyder_Snyper6-Aug-07 9:43 
GeneralRe: Object Serialization with an ArrayList Pin
Hessam Jalali6-Aug-07 9:49
Hessam Jalali6-Aug-07 9:49 
Sorry About that Blush | :O

i put it all here

<br />
<br />
 [Serializable]<br />
class GraphicsPathData<br />
{<br />
byte[] types;<br />
PointF[] points;<br />
FillMode fillMode;<br />
<br />
public GraphicsPathData(GraphicsPath gp)<br />
{<br />
this.types = gp.PathTypes;<br />
this.points = gp.PathPoints;<br />
this.fillMode = gp.FillMode;<br />
}<br />
<br />
public static System.IO.Stream Serialize(GraphicsPathData gpd)<br />
{<br />
System.IO.MemoryStream ms=new System.IO.MemoryStream();<br />
<br />
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();<br />
<br />
bf.Serialize(ms, gpd);<br />
ms.Flush();<br />
return ms;<br />
}<br />
<br />
public static GraphicsPathData Deserialize(System.IO.Stream stream)<br />
{<br />
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();<br />
<br />
object obj=bf.Deserialize(stream);<br />
GraphicsPathData gpd =obj as GraphicsPathData;<br />
return gpd;<br />
}<br />
<br />
public static GraphicsPath GetGraphicsPath(GraphicsPathData gpd)<br />
{<br />
return new GraphicsPath(gpd.points, gpd.types, gpd.fillMode);<br />
}<br />
<br />
public static GraphicsPath GetGraphicsPath(System.IO.Stream gpdStream)<br />
{<br />
return GetGraphicsPath(Deserialize(gpdStream));<br />
}<br />
}<br />
<br />



and I tested that like

<br />
<br />
GraphicsPath gp = new GraphicsPath();<br />
gp.AddEllipse(10, 10, 100, 100);<br />
<br />
GraphicsPathData gpd = new GraphicsPathData(gp);<br />
System.IO.Stream gpdStream = GraphicsPathData.Serialize(gpd);<br />
<br />
//Just create a new stream for  exchanging of data!!!<br />
<br />
System.IO.Stream newStream = new System.IO.MemoryStream(((System.IO.MemoryStream)gpdStream).ToArray());<br />
<br />
GraphicsPath gpDeserialized = GraphicsPathData.GetGraphicsPath(newStream);<br />
<br />

GeneralRe: Object Serialization with an ArrayList [modified] Pin
Spyder_Snyper6-Aug-07 10:36
Spyder_Snyper6-Aug-07 10:36 
GeneralRe: Object Serialization with an ArrayList Pin
cyn86-Aug-07 20:17
cyn86-Aug-07 20:17 
GeneralRe: Object Serialization with an ArrayList Pin
Hessam Jalali6-Aug-07 21:25
Hessam Jalali6-Aug-07 21:25 
GeneralRe: Object Serialization with an ArrayList Pin
Spyder_Snyper7-Aug-07 4:39
Spyder_Snyper7-Aug-07 4:39 
GeneralRe: Object Serialization with an ArrayList Pin
Hessam Jalali7-Aug-07 6:43
Hessam Jalali7-Aug-07 6:43 
QuestionCannot generate SSPI context error Pin
xbiplav6-Aug-07 5:17
xbiplav6-Aug-07 5:17 
AnswerRe: Cannot generate SSPI context error Pin
snorkie6-Aug-07 11:49
professionalsnorkie6-Aug-07 11:49 
AnswerRe: Cannot generate SSPI context error Pin
mav.northwind7-Aug-07 1:18
mav.northwind7-Aug-07 1:18 
QuestionFile Encoding Pin
Sean_B6-Aug-07 4:22
Sean_B6-Aug-07 4:22 
AnswerRe: File Encoding Pin
Luc Pattyn6-Aug-07 4:37
sitebuilderLuc Pattyn6-Aug-07 4:37 
GeneralRe: File Encoding Pin
Sean_B6-Aug-07 5:26
Sean_B6-Aug-07 5:26 
QuestionPNG compression? Pin
Mad_Mike6-Aug-07 3:52
Mad_Mike6-Aug-07 3:52 
AnswerRe: PNG compression? [modified] Pin
PhilDanger6-Aug-07 4:11
PhilDanger6-Aug-07 4:11 
GeneralRe: PNG compression? Pin
Mad_Mike6-Aug-07 4:14
Mad_Mike6-Aug-07 4:14 
GeneralRe: PNG compression? Pin
PhilDanger6-Aug-07 4:29
PhilDanger6-Aug-07 4:29 
GeneralRe: PNG compression? Pin
Mad_Mike6-Aug-07 5:04
Mad_Mike6-Aug-07 5:04 
Questionexcel Pin
TAREQ F ABUZUHRI6-Aug-07 3:10
TAREQ F ABUZUHRI6-Aug-07 3:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.