Click here to Skip to main content
15,904,416 members
Home / Discussions / C#
   

C#

 
AnswerRe: XML deserializer question Pin
Judah Gabriel Himango9-Sep-05 10:24
sponsorJudah Gabriel Himango9-Sep-05 10:24 
General[Message Deleted] Pin
Tom Wright9-Sep-05 11:34
Tom Wright9-Sep-05 11:34 
GeneralRe: [Msg Deleted] Pin
Judah Gabriel Himango9-Sep-05 11:39
sponsorJudah Gabriel Himango9-Sep-05 11:39 
GeneralRe: [Msg Deleted] Pin
Tom Wright9-Sep-05 11:56
Tom Wright9-Sep-05 11:56 
GeneralRe: [Msg Deleted] Pin
Judah Gabriel Himango9-Sep-05 19:17
sponsorJudah Gabriel Himango9-Sep-05 19:17 
GeneralRe: [Msg Deleted] Pin
Tom Wright9-Sep-05 12:17
Tom Wright9-Sep-05 12:17 
GeneralRe: [Msg Deleted] Pin
Judah Gabriel Himango9-Sep-05 19:17
sponsorJudah Gabriel Himango9-Sep-05 19:17 
GeneralRe: XML deserializer question Pin
Tom Wright9-Sep-05 11:42
Tom Wright9-Sep-05 11:42 
I am doing this:
<br />
		public class CommBaseSettings <br />
		{<br />
			public string port = "COM1:";<br />
			public int baudRate = 2400;<br />
			public Parity parity = Parity.none;<br />
			public int dataBits = 8;<br />
..........<br />
			public void SaveAsXML(Stream s)<br />
			{<br />
				XmlSerializer sr = new XmlSerializer(this.GetType());<br />
				sr.Serialize(s, this);<br />
			}<br />
<br />
			public static CommBaseSettings LoadFromXML(Stream s)<br />
			{<br />
				return LoadFromXML(s, typeof(CommBaseSettings));<br />
			}<br />
<br />
			protected static CommBaseSettings LoadFromXML(Stream s, Type t)<br />
			{<br />
				XmlSerializer sr = new XmlSerializer(t);<br />
				try<br />
				{<br />
					return (CommBaseSettings)sr.Deserialize(s);<br />
				}<br />
				catch<br />
				{<br />
					return null;<br />
				}<br />
			}<br />
		}<br />

But it returns null even though I know the file exists
Thanks

Tom Wright
tawright915@yahoo.com
GeneralRe: XML deserializer question Pin
S. Senthil Kumar9-Sep-05 22:44
S. Senthil Kumar9-Sep-05 22:44 
GeneralRe: XML deserializer question Pin
Tom Wright10-Sep-05 4:48
Tom Wright10-Sep-05 4:48 
QuestionGenerics and pointers Pin
kippolito9-Sep-05 9:46
kippolito9-Sep-05 9:46 
AnswerRe: Generics and pointers Pin
Judah Gabriel Himango9-Sep-05 10:23
sponsorJudah Gabriel Himango9-Sep-05 10:23 
Questionstatusbar Pin
xilefxilef9-Sep-05 7:59
xilefxilef9-Sep-05 7:59 
AnswerRe: statusbar Pin
miah alom9-Sep-05 8:05
miah alom9-Sep-05 8:05 
GeneralRe: statusbar Pin
xilefxilef9-Sep-05 8:11
xilefxilef9-Sep-05 8:11 
GeneralRe: statusbar Pin
miah alom9-Sep-05 8:32
miah alom9-Sep-05 8:32 
GeneralRe: statusbar Pin
xilefxilef9-Sep-05 8:47
xilefxilef9-Sep-05 8:47 
GeneralRe: statusbar Pin
miah alom9-Sep-05 9:50
miah alom9-Sep-05 9:50 
GeneralRe: statusbar Pin
xilefxilef9-Sep-05 10:38
xilefxilef9-Sep-05 10:38 
GeneralRe: statusbar Pin
miah alom9-Sep-05 10:44
miah alom9-Sep-05 10:44 
GeneralRe: statusbar Pin
xilefxilef9-Sep-05 10:55
xilefxilef9-Sep-05 10:55 
GeneralRe: statusbar Pin
miah alom9-Sep-05 11:04
miah alom9-Sep-05 11:04 
GeneralRe: statusbar Pin
xilefxilef9-Sep-05 13:24
xilefxilef9-Sep-05 13:24 
QuestionFont in resource Pin
Leyu9-Sep-05 7:22
Leyu9-Sep-05 7:22 
QuestionHow to declare an Array of Pens? Pin
...---...9-Sep-05 6:59
...---...9-Sep-05 6:59 

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.