Click here to Skip to main content
15,895,667 members
Home / Discussions / C#
   

C#

 
AnswerRe: Distributing C# Applications? Pin
Ed.Poore18-Mar-06 11:00
Ed.Poore18-Mar-06 11:00 
AnswerRe: Distributing C# Applications? Pin
Thomas Stockwell18-Mar-06 13:39
professionalThomas Stockwell18-Mar-06 13:39 
Questionhow to the Cursor Location using C# 2.0 *** Urgent Pin
VenkataRamana.Gali18-Mar-06 8:48
VenkataRamana.Gali18-Mar-06 8:48 
AnswerRe: how to the Cursor Location using C# 2.0 *** Urgent Pin
Thomas Stockwell18-Mar-06 13:41
professionalThomas Stockwell18-Mar-06 13:41 
QuestionNewbie: return const object? Pin
Dominik Reichl18-Mar-06 8:00
Dominik Reichl18-Mar-06 8:00 
AnswerRe: Newbie: return const object? Pin
CWIZO18-Mar-06 8:25
CWIZO18-Mar-06 8:25 
AnswerRe: Newbie: return const object? Pin
Richard Andrew x6418-Mar-06 12:34
professionalRichard Andrew x6418-Mar-06 12:34 
AnswerRe: Newbie: return const object? Pin
S. Senthil Kumar18-Mar-06 20:05
S. Senthil Kumar18-Mar-06 20:05 
QuestionIs there any way ... ? Pin
mostafa_h18-Mar-06 7:54
mostafa_h18-Mar-06 7:54 
AnswerRe: Is there any way ... ? Pin
Ed.Poore18-Mar-06 12:51
Ed.Poore18-Mar-06 12:51 
QuestionThe mysterious Desktop redraw Pin
Pascal Ganaye18-Mar-06 7:46
Pascal Ganaye18-Mar-06 7:46 
GeneralRe: The mysterious Desktop redraw Pin
Guffa18-Mar-06 8:34
Guffa18-Mar-06 8:34 
AnswerRe: The mysterious Desktop redraw Pin
Robert Rohde18-Mar-06 9:04
Robert Rohde18-Mar-06 9:04 
GeneralRe: The mysterious Desktop redraw Pin
Pascal Ganaye20-Mar-06 7:29
Pascal Ganaye20-Mar-06 7:29 
QuestionWorking with Outlook Pin
Yevgeny Efter18-Mar-06 7:10
Yevgeny Efter18-Mar-06 7:10 
AnswerRe: Working with Outlook Pin
Pascal Ganaye18-Mar-06 7:30
Pascal Ganaye18-Mar-06 7:30 
GeneralRe: Working with Outlook Pin
Yevgeny Efter18-Mar-06 17:49
Yevgeny Efter18-Mar-06 17:49 
QuestionRAS Connection Pin
plz.ze18-Mar-06 5:42
plz.ze18-Mar-06 5:42 
QuestionSorry all Pin
CoolASL18-Mar-06 5:40
CoolASL18-Mar-06 5:40 
GeneralRe: Sorry all Pin
Guffa18-Mar-06 8:28
Guffa18-Mar-06 8:28 
GeneralRe: Sorry all Pin
CoolASL19-Mar-06 0:29
CoolASL19-Mar-06 0:29 
QuestionCopy/paste of generic collection Pin
[Gone]18-Mar-06 4:54
[Gone]18-Mar-06 4:54 
My copy/paste operation results in a MemoryStream full of '\0' characters on the Clipboard.
Maybe my approach to copy/paste is wrong when handling generic types?

All entries in the CollectionBase are, of course, ISerializable and the binary serialization to file fully works. The collection is, to sketch the context, a set of shapes and connections of a diagram (application), see the Netron project[^] for details.

Thank you so much for you help. Rose | [Rose]


The copy operation:

CollectionBase<IDiagramEntity> copy = MyDeepCopyOfTheCollectionViaSerialization();
DataFormats.Format format =
DataFormats.GetFormat(typeof(CollectionBase<IDiagramEntity> ).FullName);
IDataObject dataObject = new DataObject();
dataObject.SetData(format.Name, false, copy);
Clipboard.SetDataObject(dataObject, false);


where the MyDeepCopyOfTheCollectionViaSerialization() is :

CollectionBase<T> newobj = null;
MemoryStream stream = new MemoryStream();
GenericFormatter<BinaryFormatter> f = new
GenericFormatter<BinaryFormatter>();
f.Serialize(stream, this);
stream.Seek(0, SeekOrigin.Begin);
newobj = f.Deserialize<CollectionBase<T>>(stream);
stream.Close();
return newobj;


And finally the Paste operation is:

IDataObject data = Clipboard.GetDataObject();
string format = typeof(CollectionBase<IDiagramEntity> ).FullName;
if (data.GetDataPresent(format))
{
 //data.GetData(format) is a MemoryStream rather than a generic collection!  X| 
} 


I thought about it,
I stood up
and I did it.
The Netron Project



-- modified at 10:59 Saturday 18th March, 2006
AnswerRe: Copy/paste of generic collection Pin
leppie18-Mar-06 7:11
leppie18-Mar-06 7:11 
AnswerRe: Copy/paste of generic collection Pin
[Gone]18-Mar-06 7:30
[Gone]18-Mar-06 7:30 
GeneralRe: Copy/paste of generic collection Pin
leppie18-Mar-06 7:43
leppie18-Mar-06 7:43 

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.