|
|
Don't know if you are serious, or if you are playing a practical joke on this (on behalf on a semi-drunken state of mind. huh! )
That XmlTextWriter_ class is the derived class. To make it explicit :
public class XmlTextWriter_ : System.Xml.XmlTextWriter
{
...
}
Thus the fields I refer to, and tweak a little bit, are obviously those from the base class. No rocket science here.
|
|
|
|
|
|
You make a point here.
The entire XmlTextWriter class implementation must be rewritten.
Instead, as I pointed first, a better solution is to encode the string itself (whether it's hold by StringWriter, StringBuilder, or even String doesn't matter much) thanks to the Encoding derived classes (System.Text.UTF8Encoding, ...).
|
|
|
|
|
Hi,
I'm just wondering if there is a simple and straightforward way to serialize a class into an XML formatted file. Could somebody pls. point me into the right direction?
Any help is highly appreceated.
Matthias
In theory, there is no difference between theory and practice. In practice, however, there is.
(unknown author)
|
|
|
|
|
public class Class1
{
public int number;
public string name;
[STAThread]
static void Main(string[] args)
{
Class1 c = new Class1();
c.name = "Hello";
c.number = 1;
XmlSerializer xser = new XmlSerializer(c.GetType());
FileStream fs = File.Open("Class.xml", FileMode.OpenOrCreate);
xser.Serialize(fs, c);
fs.Close();
}
}
Make sure class is public and the properties you want is public and the class must have a default constructor.
And the output:
<?xml version="1.0"?>
<Class1 xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<number>1</number>
<name>Hello</name>
</Class1>
CHeers
WebBoxes - Yet another collapsable control, but it relies on a "graphics server" for dynamic pretty rounded corners, cool arrows and unlimited font support.
|
|
|
|
|
Thanks leppie!
Matthias
In theory, there is no difference between theory and practice. In practice, however, there is.
(unknown author)
|
|
|
|
|
Does anybody have any advice on how to 'Step-up' my programming skills.
I have been developing apps for years but would like to get a little more serious about my development.
How do you gurus go about delving into the background of controls and functions? I am mainly used to coding my own stuff from scratch, but then I see a 'system' way of doing it in about 3 lines of code.
Any ideas on how to start delving into the depths of development?
|
|
|
|
|
LeeDaviesVBSource wrote:
Does anybody have any advice on how to 'Step-up' my programming skills.
static void Main()
{
StringBuilder yourName = "LeeDaviesVBSource";
yourName.Remove("VB");
return;
}
Seriously though, if you can, I'd go out and buy Inside C# (Tom Archer), Applied .NET Framework Programming (Jeff Richter), Inside IL (Serge Lidin), and Programming Windows with C#(Charles Petzold). They're all from MSPress. Another book to check out would be Essential .NET (Don Box) from Addison Wesley. These are some great books. Otherwise, just experiment. Find something obscure that you want to look at and go for it.
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past.
-Chris Maunder
Microsoft has reinvented the wheel, this time they made it round.
-Peterchen on VS.NET
|
|
|
|
|
What's the easiest way in C# to enumerate a systems
DSN settings ?
Thanks !!!!
|
|
|
|
|
hi,
beside a listbox,I put two buttons, one with up arrow icon, and one with down arrow icon.
I wish the selected item can be move up or down by pressing one of two buttons, for example,
there are 4 items in listbox, item1,item2,item3,item4, after selected item2, then press the up arrow button a time, the order become item2,item1,item3,item4, and if press the down arrow button three times,the order is
item1,item3,item4,item2.
and how can I do that?
thanks for any idea.
|
|
|
|
|
|
Hello all,
How can I specify two images for every button in a toolbar? One b/w image for normal mode and one color image for mouseover ? Just as we have it in Outlook Express. I can only assign a single image to each button So is it impossible ?
Thanks
Smitha
Whenever I see an old lady slip and fall on a wet sidewalk, my first instinct is to laugh. But then I think, what if I was an ant, and she fell on me. Then it wouldn't seem quite so funny.
|
|
|
|
|
I'm just curious, are there already simple but completed applications or games that use Managed DirectX?
|
|
|
|
|
|
I just posted a DirectDraw sample using C# and DirectX9. Its under the DirectX section.
Steve Maier, MCSD
|
|
|
|
|
Question: I have this function that I call all thoughout my code. 90% of the time it works without a hitch. But lately when debugging it will give me the same error every time when the function below is executed in a certain place in my code.
When stepping over the bold line listed below, I get this popup:
TITLE = Microsoft Development Environment
MESSAGE = There is no source code available for the current location.
So, I tried calling the exact function call a half dozen times in different locations working my way back up the callstack. Higher in the callstack I have no problem. But go down 5 or so levels and KAPOW!
FileInfo *FileGetList(String *filePattern)[]<br />
{<br />
FileInfo *fileList[];<br />
String *directory = filePattern->Substring(0, filePattern->LastIndexOf("\\", filePattern->Length));<br />
int pos = filePattern->LastIndexOf("\\", filePattern->Length) + 1;<br />
String *pattern = filePattern->Substring(pos, filePattern->Length-pos);<br />
DirectoryInfo *dir = new DirectoryInfo(directory);<br />
<br />
fileList = dir->GetFiles(pattern);<br />
<br />
return fileList;<br />
}
The strange thing is, if this were not strange enough, I can step over the DirectoryInfo constructor with no error but when I expand the dir variable in the watch window, 3 of its member variables read: error: cannot obtain value. It is then that I know that the dir->GetFiles() command is going to go nuts.
Is there a posibility that the DirectoryInfo class I am constructing is not allocating correctly? Am I out of heap space? Am I making a stupid beginners mistake somewhere?
Help
|
|
|
|
|
|
Sorry, This code is Managed C++. Just replace the -> with . and remove the * and its c#.
|
|
|
|
|
I have a windows application called X, I build it, and evidently I can run the executable X.exe.
But now, I build this application to a X.dll; and I want to load that X.dll from another application YYY.EXE, and start the X-application.
I tried in Y:
Assembly assemblyX = Assembly.Load("X"); // works
Type typeX = assemblyX.GetType("namespace + classname"); // works
MethodInfo methodinfoCOnstructor = typePlannet.GetMethod("?"); // ?
How can I start application X?
Thanks!
|
|
|
|
|
I just found it myself:
Assembly assPlannet = Assembly.Load("Plannet");
Type typePlannet = assPlannet.GetType("Conseur.Plannet.PlannetClient");
MethodInfo methodinfoMain = typePlannet.GetMethod("Main");
Object obj = Activator.CreateInstance(typePlannet);
Object[] args = new Object[1];
methodinfoMain.Invoke(obj, null);
|
|
|
|
|
I'm using ODBC to connect to an AS400 DB2 tables. I need also to get full information of each table, e.g. created date, last modified date, modified user Id, table actual size, etc?
Jassim Rahma
|
|
|
|
|
Can I have multi columns in a comboBox?
Jassim Rahma
|
|
|
|
|
Nope. You'd have to make a new class and then inherit from ComboBox. Then do OwnerDraw.
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past.
-Chris Maunder
Microsoft has reinvented the wheel, this time they made it round.
-Peterchen on VS.NET
|
|
|
|
|
If I have the following string :
CCCAABAAABC
and I neet to loop to replace all A to Z, all B to Y and all C to X. How can do it? can I have a sample code please?
Jassim Rahma
|
|
|
|