Click here to Skip to main content
15,905,877 members
Home / Discussions / C#
   

C#

 
AnswerRe: IList and BindingSource Problem Pin
Wjousts8-Jun-07 15:25
Wjousts8-Jun-07 15:25 
QuestionForm Application with Plugins via assembly loading Pin
ATCsharp8-Jun-07 2:47
ATCsharp8-Jun-07 2:47 
AnswerRe: Form Application with Plugins via assembly loading Pin
ATCsharp8-Jun-07 3:01
ATCsharp8-Jun-07 3:01 
GeneralRe: Form Application with Plugins via assembly loading Pin
Not Active8-Jun-07 3:12
mentorNot Active8-Jun-07 3:12 
GeneralRe: Form Application with Plugins via assembly loading Pin
ATCsharp8-Jun-07 3:23
ATCsharp8-Jun-07 3:23 
GeneralRe: Form Application with Plugins via assembly loading Pin
Not Active8-Jun-07 3:28
mentorNot Active8-Jun-07 3:28 
QuestionPlay MKV files in embedded media player Pin
sypack8-Jun-07 2:16
sypack8-Jun-07 2:16 
AnswerRe: Play MKV files in embedded media player Pin
Bekjong8-Jun-07 2:32
Bekjong8-Jun-07 2:32 
GeneralRe: Play MKV files in embedded media player Pin
sypack8-Jun-07 2:37
sypack8-Jun-07 2:37 
QuestionEncryption and Decryption Pin
M. J. Jaya Chitra8-Jun-07 2:15
M. J. Jaya Chitra8-Jun-07 2:15 
AnswerRe: Encryption and Decryption Pin
Sathesh Sakthivel8-Jun-07 2:19
Sathesh Sakthivel8-Jun-07 2:19 
AnswerRe: Encryption and Decryption Pin
Pixinger778-Jun-07 3:10
Pixinger778-Jun-07 3:10 
GeneralRe: Encryption and Decryption Pin
originSH8-Jun-07 3:48
originSH8-Jun-07 3:48 
AnswerRe: Encryption and Decryption Pin
Russell Jones8-Jun-07 4:39
Russell Jones8-Jun-07 4:39 
QuestionSQL Connection DialogBox Pin
ScottM18-Jun-07 2:07
ScottM18-Jun-07 2:07 
QuestionPacking a class into a byte array - would [Serializable] do the trick? Pin
Dewald8-Jun-07 2:02
Dewald8-Jun-07 2:02 
AnswerRe: Packing a class into a byte array - would [Serializable] do the trick? Pin
AikinX8-Jun-07 2:16
AikinX8-Jun-07 2:16 
GeneralRe: Packing a class into a byte array - would [Serializable] do the trick? Pin
Dewald8-Jun-07 2:38
Dewald8-Jun-07 2:38 
GeneralRe: Packing a class into a byte array - would [Serializable] do the trick? Pin
AikinX8-Jun-07 3:27
AikinX8-Jun-07 3:27 
GeneralRe: Packing a class into a byte array - would [Serializable] do the trick? Pin
Dewald8-Jun-07 3:37
Dewald8-Jun-07 3:37 
GeneralRe: Packing a class into a byte array - would [Serializable] do the trick? Pin
AikinX8-Jun-07 4:08
AikinX8-Jun-07 4:08 
AnswerRe: Packing a class into a byte array - would [Serializable] do the trick? [modified] Pin
AikinX8-Jun-07 20:43
AikinX8-Jun-07 20:43 
Dewald, last night I got an idea: in unmanaged C++ we just need to look at the object as byte array:
<br />
// Some & and * have to be added to next code to say we are working with references<br />
MyClass myCl = new MyClass();<br />
byte[] array = meCl; // this operation is allowed fo references<br />
// coping this array to new one or sending it as is through TCP socet<br />

But in .Net we haven't references (that is very good, in my opinion), but we have some classes that allow to work with objects by references way.
One of them is System.Runtime.InteropServices.Marshal

I have never worked with, just herad about it.
I have being looking through this and find some pairs of static methods wich can help you (I guess):
To get IntPTR from your object:
public static extern void StructureToPtr(object structure, IntPtr ptr, bool fDeleteOld);
public static object PtrToStructure(IntPtr ptr, Type structureType)

To copy to byte array:
public static void Copy(IntPtr source, byte[] destination, int startIndex, int length);
public static void Copy(byte[] source, int startIndex, IntPtr destination, int length)
Or
public static extern byte ReadByte(object ptr, int ofs);
public static extern void WriteByte(IntPtr ptr, int ofs, byte val);

Regards.

P.S. IntPtr (intPointer) is Net analog of C++ pointers


-- modified at 2:48 Saturday 9th June, 2007
GeneralRe: Packing a class into a byte array - would [Serializable] do the trick? Pin
AikinX8-Jun-07 23:50
AikinX8-Jun-07 23:50 
GeneralRe: Packing a class into a byte array - would [Serializable] do the trick? Pin
Dewald10-Jun-07 23:09
Dewald10-Jun-07 23:09 
GeneralRe: Packing a class into a byte array - would [Serializable] do the trick? Pin
AikinX11-Jun-07 0:15
AikinX11-Jun-07 0:15 

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.