Click here to Skip to main content
15,867,835 members
Home / Discussions / C#
   

C#

 
GeneralRe: XML Serializer: circular reference due to public attribute? Pin
Judah Gabriel Himango4-Sep-05 14:59
sponsorJudah Gabriel Himango4-Sep-05 14:59 
QuestionVS7: No Exception Info under Debugger? Pin
peterchen3-Sep-05 21:02
peterchen3-Sep-05 21:02 
QuestionVS7 Forms designer - 2 questions Pin
peterchen3-Sep-05 20:43
peterchen3-Sep-05 20:43 
AnswerRe: VS7 Forms designer - 2 questions Pin
Mathew Hall3-Sep-05 21:25
Mathew Hall3-Sep-05 21:25 
AnswerAhhhh! Pin
peterchen3-Sep-05 22:02
peterchen3-Sep-05 22:02 
GeneralRe: Ahhhh! Pin
Mathew Hall3-Sep-05 22:14
Mathew Hall3-Sep-05 22:14 
QuestionHow to add Binary Resources Pin
Heinz_3-Sep-05 20:33
Heinz_3-Sep-05 20:33 
AnswerRe: How to add Binary Resources Pin
turbochimp4-Sep-05 16:34
turbochimp4-Sep-05 16:34 
I would look closely at the System.Resources.ResourceWriter class; I think it does everything you're looking for.

I actually used it one time when I wanted to embed some sound in a Windows app.

Something like the following would probably do the trick if you're just wanting to write binary resources to the file:

using System;
using System.IO;
using System.Resources;
using System.Runtime.Serialization.Formatters.Binary;

class ResourceUtility
{
	public static void WriteResourceToFile(string name, object graph, string fileName)
	{
		// Serialize the resource
		BinaryFormatter serializer = new BinaryFormatter();
		MemoryStream mem = new MemoryStream();
		serializer.Serialize(mem, graph);

		// Write the serialized graph to a resource file.
		using (ResourceWriter writer = new ResourceWriter(fileName))
		{
			writer.AddResource(name, mem.GetBuffer());
			writer.Generate();
			writer.Close();
		}
	}
}


The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

GeneralRe: How to add Binary Resources Pin
Heinz_5-Sep-05 9:51
Heinz_5-Sep-05 9:51 
GeneralRe: How to add Binary Resources Pin
turbochimp6-Sep-05 11:21
turbochimp6-Sep-05 11:21 
GeneralRe: How to add Binary Resources Pin
Heinz_7-Sep-05 19:55
Heinz_7-Sep-05 19:55 
GeneralRe: How to add Binary Resources Pin
turbochimp7-Sep-05 20:43
turbochimp7-Sep-05 20:43 
GeneralRe: How to add Binary Resources Pin
Heinz_8-Sep-05 11:31
Heinz_8-Sep-05 11:31 
Questionplz help me Pin
Sayed Sajjad Raza Zaidi3-Sep-05 20:12
Sayed Sajjad Raza Zaidi3-Sep-05 20:12 
AnswerRe: plz help me Pin
Mohamad Al Husseiny4-Sep-05 10:14
Mohamad Al Husseiny4-Sep-05 10:14 
Questionparse string by using xml Pin
savage_3-Sep-05 13:50
savage_3-Sep-05 13:50 
AnswerRe: parse string by using xml Pin
Guffa3-Sep-05 15:11
Guffa3-Sep-05 15:11 
QuestionPlease Help:Marshaling Question?? Pin
E6AD3-Sep-05 12:51
E6AD3-Sep-05 12:51 
QuestionURGENTLY complicated Pin
malak nour3-Sep-05 12:03
malak nour3-Sep-05 12:03 
AnswerRe: URGENTLY complicated Pin
Judah Gabriel Himango3-Sep-05 12:26
sponsorJudah Gabriel Himango3-Sep-05 12:26 
Questionhelp regarding server monitoring Pin
vkas_in_guj3-Sep-05 10:10
vkas_in_guj3-Sep-05 10:10 
AnswerRe: help regarding server monitoring Pin
Dave Kreskowiak3-Sep-05 11:34
mveDave Kreskowiak3-Sep-05 11:34 
QuestionHow to Convert this in C# Pin
majidbhutta3-Sep-05 8:21
majidbhutta3-Sep-05 8:21 
Answer[Message Deleted] Pin
philip_cole3-Sep-05 9:18
philip_cole3-Sep-05 9:18 
AnswerRe: How to Convert this in C# Pin
philip_cole3-Sep-05 9:30
philip_cole3-Sep-05 9:30 

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.