|
When i only mark a class as [Serializeable] then i got an SerializeException when i deserialize the class wich say that the necessary constuctor of the class is missing.
So thats why i implemented the ISerializeable-Interface with its methodes...
[SecurityPermissionAttribute( SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter )]
void ISerializable.GetObjectData( SerializationInfo info, StreamingContext context ) {
this.GetObjectData( info, context );
}
public override void GetObjectData( SerializationInfo info, StreamingContext context ){
info.AddValue( "member", member );
...
}
...and the necessary constructor...
public ClassName( SerializationInfo info, StreamingContext context ){
member = info.GetValue( "member", typeof( member ) );
...
}
and cause that works fine was i thinking...
"Everytime when i wanna serialize a class i have to implement the ISerializeable-interface"
...but i read somewhere that it is enough in some cases to mark a class as [Serializeable].
BTW: i use BinaryFormatter to serialize and deserialize my classes.
|
|
|
|
|
Marking your class [Serializable()] is only enough if all of your class members are themselves serializable: The exception you're getting is because one of your members doesn't support serialization.
If you don't really need the member just mark it as [field:NonSerialized()] and the exception will go away.
Otherwise, make sure it supports serialization. You can do this by marking the class as [Serializable()] itself. Determine which members should be saved, mark all others as [field:NonSerialized()], repeat the operation for your member's memberclasses (and enumerations), and so on, until you reach a class with only primitive types.
This mechanism provides an easier, faster and less errorprown way to serialize, I prefer it over ISerialzable...
Standards are great! Everybody should have one!
|
|
|
|
|
Can a ToolStripProgressBar/progressbar take a float value to get incremented? If so then how?
|
|
|
|
|
GunaChinna wrote: Can a ToolStripProgressBar/progressbar take a float value to get incremented?
No, it can't.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
i need an event in datagridview that will be called for every row that is binded to the grid in windows application. is there an event?
|
|
|
|
|
Why do you need the event? there is always an option to access the data that is binded to the datagrid. If you populate your grid with a dataset try
<code>
foreach (System.Data.DataRow dr in dsModApp.Tables[0].Rows)
{
myList.Add(dr.ItemArray[0].ToString());
}
</code>
here i retireve the first column that is my select statement and thus position [0] in the dataset that is returned. Then i add the information to an arraylist for other purposes. hope it helps
Riaan Booyzen
|
|
|
|
|
Hi,
You can use the RowsAdded event on the grid. It is fired when you add a row to the grid... It includes when you bind a dataset, then it is fired for every row.
|
|
|
|
|
how to run console application in command prompt.
the keywords to run...
like csc Program.cs...........
whats it i dont know exactly how to do it.
|
|
|
|
|
After you have compiled the application, you will find the .exe file in the bin folder. That is the program that you run.
---
Year happy = new Year(2007);
|
|
|
|
|
csc compiles the cs file. The exe will be generated. You then run the exe.
|
|
|
|
|
You know there is a Main method like this;
static void Main(string[] args)
args is an array which contains commands of your program.exe
check this one;
static void Main(string[] args)<br />
{<br />
if (args[0] == "hello")<br />
{<br />
Console.WriteLine("args[0] = {0}", args[0]);<br />
}<br />
if (args[1] == "world")<br />
{<br />
Console.WriteLine("args[1] = {0}", args[1]);<br />
}<br />
}
in this case, write "programpath\yourprogramname.exe hello world" and viola!
|
|
|
|
|
"
I have done one desktop application in visual c#, i want to give
online updations for that software .
i need full flow and coding for this "
i think given link (http://www.codeproject.com/useritems/QuickClickOnceArticle.asp)has the answer for my question...
thank u ...keep in touch with me
we are in illusionary life
|
|
|
|
|
Post follow-ups as replies in the same thread instead of starting a new thread.
---
Year happy = new Year(2007);
|
|
|
|
|
You are welcome.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
its only for testing purpose
ok Developer
|
|
|
|
|
doing testing
ok Developer
|
|
|
|
|
Stop wasting bandwidth. There are millions of messages on these forums. If it didn't work already I think we'd know!
|
|
|
|
|
Why don't you test your own message board. This one works fine.
|
|
|
|
|
Congratulations! You failed the test!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
i need a program in c# that this program write value of sound decibel from sound card in a textarea
i don't need a graphical program . i need program that can getback to me value
|
|
|
|
|
is there any way i can move enumerator back one position
bia
|
|
|
|
|
No. You can only more forward one step or back to the beginning.
---
Year happy = new Year(2007);
|
|
|
|
|
Just curious, why would you need that?
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
actually im makin an urdu editor and if any arror occurs i ned to move bak to previous word nd i hasd to code a loooong loong process for this thas y
thanks ny ways
|
|
|
|
|
Why not simply maintain a moving cache of the last N entries you iterated through? e.g
foreach (string x in y)
{
/* operations here */
string previousx = x;
}
|
|
|
|