|
Your alternative to the BinaryFormatter is the SOAPFormatter, but beware those files are @#$@## HUGE! XML serialization has many drawbacks, but those are tradeoffs for space. Another thing you can look at is the SerializationState (?). There is an enum with various options how the object will be de/serialized for persistance.
The ideal solution is to build some "basic" XML serializable objects and use a wrapper for the more complicated stuff.
HTH, I wish someone can create a "simple" solution for this.
<a TITLE="See my user info" href=http:
|
|
|
|
|
Ok, going through this, implementing my xml deserializer is turning out to be rather simple so far, but my needs for it are rather simple.
Only, I've run into an embarrasingly simple problem.
I get all the public, writeable properties in the type, and then look for corresponding information in the xml file.
If the property type is not a value type, then I do the same process for the object.
The only problem is when it's an array. If the property type returns as System.Array, how can I tell what type of array the property wants? As in string[], int[], object[], etc.
I am of course assuming that if I have a property of type string[], when I query the properties type it will return System.Array.
Thanks again
Kris
|
|
|
|
|
YagiSka wrote:
Only, I've run into an embarrasingly simple problem.
I only learnt of this recently too after a year
Type.GetElementType()
Note: It does not work on interfaces
<a TITLE="See my user info" href=http:
|
|
|
|
|
Do you have to use ADO.NET with C# or can you use the older versions of ADO from MDAC?
If you can use ADO are there any "gotchas" (problems) that I should look out for?
Thanks!
-Al
|
|
|
|
|
You can use a OleDbDataAdapter (generic provider) that can communicate with any OLE DB data source.
Connection and Command objects are almost equivalent to their ADO
counterparts.
IIRC, DataAdapter and DataSet have no real equivalent in ADO.
The only job you start at the top is when you dig a grave. This signature was created by "Code Project Quoter".
|
|
|
|
|
It should be possible through COM interop, no idea on any 'gotchas' though.
James
"I despise the city and much prefer being where a traffic jam means a line-up at McDonald's"
Me when telling a friend why I wouldn't want to live with him
|
|
|
|
|
albean wrote:
If you can use ADO are there any "gotchas" (problems) that I should look out for?
If you create lots of ADO Recordsets, your program can behave like it's leaking memory. Technically, it isn't, but it will look like a leaky program.
Don't forget to call System.Runtime.InteropServices.Marshal.ReleaseComObject on every COM object that you have created on managed code, until it returns 0.
Kant wrote:
Actually she replied back to me "You shouldn't fix the bug. You should kill it"
|
|
|
|
|
Daniel Turini wrote:
System.Runtime.InteropServices.Marshal.ReleaseComObject
From Chris's weblog, that doing so in normal desktop apps, which involves modest com interop, this could lead to additional problems.
Even though half of what he say's is above my head, I got curious after reading his concolusion part.
I'm a bit confused here, whether failing to do a releasecomobject would cause a performance penalty or a memory leak.
And also I would get more benefits only if its a server based app.
Here is the link[^]
Cheers,
Kannan
|
|
|
|
|
Kannan Kalyanaraman wrote:
From Chris's weblog, that doing so in normal desktop apps, which involves modest com interop, this could lead to additional problems.
Even though half of what he say's is above my head, I got curious after reading his concolusion part.
I'm a bit confused here, whether failing to do a releasecomobject would cause a performance penalty or a memory leak.
And also I would get more benefits only if its a server based app.
Here is the link
I love Chris's weblog. In this case, he's stating the obvious: after you call releasecomobject until it returns 0, you cannot access the component anymore (right, you released it!).
Now, he's right: on server applications (what I do for living) you normally have a disconnected model, so, once a "job" is finished, it's better you clean up everything, except caching data. On desktop applications, you normally code for responsiveness, so dangling references are common. In this case, you need to be careful to only releasecomobject when no one is accessing it.
If your COM objects are small and not in a big number, you don't have to worry, because it will take time, but the GC will clean it up. It's only on the case when you have 10MB of RAM taken by ADO recordsets that it becomes unacceptable, because it will take ages for the GC to clean up them.
Kant wrote:
Actually she replied back to me "You shouldn't fix the bug. You should kill it"
|
|
|
|
|
Add a reference to the old ado by looking on the .Net tab in the references dialog. There is a reference there to the old adodb called adodb. I don't know of any gotcha's for you. I have only used it briefly. It worked fine for me. Very small project though.
|
|
|
|
|
I'm looking for a page on the Internet or in MSDN that describes the event hierarchy for System.Windows.Forms.Form.
I'm trying to figure out why the form1_load event keeps firing.
Thanks,
al
|
|
|
|
|
Is there something similar to app.path in C# for the path of an application's folders and files.
|
|
|
|
|
If you need the current directory, try Environment.CurrentDirectory
If you want generic Application Data directory,
try Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData
Cheers,
Kannan
|
|
|
|
|
If it's an SWF program, you can also try Application.ExecutablePath .
Greets,
Daniel
|
|
|
|
|
you can also try this :
string str;
string s;
str = Application.UserAppDataPath.ToString();
s = str.Substring(0,3);
MessageBox.Show(s);
that would return in this exapmle "C:\" , because i was testing it from a drive called C
switch(twinsOnWay)
{
case ("twins on the way"):
MessageBox.Show("for mr and mrs dynamic","twins on the way");
break;
|
|
|
|
|
Hi, all:
When I click on the menu item "Save", right after I edit the text in my Textbox control, in my WinForm, it does not cause validation of the TextBox control. Is there any way to force validation of the control. BTW, if I click on the x to close the form or any other controls on the form, it does cause validation. Any help is appreciated. Thanks in advance.
Dion
|
|
|
|
|
DO something like the following, it worked for the same problem:
if (panel1.Controls[0].DataBindings.Count > 0)
panel1.Controls[0].DataBindings[0].BindingManagerBase.EndCurrentEdit();
<a TITLE="See my user info" href=http:
|
|
|
|
|
We want to use the auto-documentation for our C# project. Since the output of the documentation is XML, I believe that I need an xsl or something like that (sorry, I'm not proficient in XML) to transform the file to whatever I want (html, ...).
Is there any example of such a thing, so I could start from there? It would be nice to add one that produces MSDN-like HTML.
|
|
|
|
|
Michel Prévost wrote:
Is there any example of such a thing, so I could start from there? It would be nice to add one that produces MSDN-like HTML.
I hate to ruin the fun you'd have with countless hours of XSL and CSS coding to achieve this result, but someone already did it
http://ndoc.sourceforge.net/[^]
Kant wrote:
Actually she replied back to me "You shouldn't fix the bug. You should kill it"
|
|
|
|
|
Ndoc[^]is the answer
Cheers,
Kannan
|
|
|
|
|
I will surely have a look at it
|
|
|
|
|
Hi,
In MFC I will often create a UI thread and use it as a worker. I do this because I find the message queue that comes with the UI thread to be very handy for recieving messages in order. When it gets a message it does some work. I also use it to aviod race conditions, i.e. I can have many threads sending messages to the queue and MFC/Windows handles the "Reader Writer" issues of the queue.
What is the equivilant of this in C#? Is there a ready made thread with a message queue where all I would have to do is wait (sleep) until a message arrives?
Thanks.
|
|
|
|
|
How to turn off computer on Win98,Me,2000,nt and XP ?
Greetings
S_W
|
|
|
|
|
I don't know if there is a .NET Framework way of doing it, but you could use the ExitWindowsEx[^] API.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
The button on the front?
Works with Linux too!
|
|
|
|