A
Alexander Muylaert
Hi,
for some reason my formatter doesn't write correct on Compact framework.
The following piece of code will demonstrate very weird behaviour with
overloading.
For some reason the inherited binarywriter doesn't take the right procedure.
He will always write 8 bytes for an integer (int), uses the Write(decimal)
Am I supposed to override ALL the methods with the same name when I
inherited one? Is this true or does the source below generates a bug?
I had this problem running on compact framework, since the other framework
supports Write(decimal) on the binarywriter.
kind regards
Alexander
private static int X = 20041101;
private class MyWriter : BinaryWriter{
public MyWriter(Stream aStream) : base(aStream){}
/* since this is not added inside the pocket framework,
i kind added it myself. Storing it as double is not a problem,
since we are reading it as double*/
public void Write(decimal value){
Write(decimal.ToDouble(value));
}
}
private void button1_Click(object sender, System.EventArgs e) {
Stream S = new MemoryStream();
MyWriter W = new MyWriter(S);
W.Write(X);
label1.Text = S.Position.ToString();
}
for some reason my formatter doesn't write correct on Compact framework.
The following piece of code will demonstrate very weird behaviour with
overloading.
For some reason the inherited binarywriter doesn't take the right procedure.
He will always write 8 bytes for an integer (int), uses the Write(decimal)
Am I supposed to override ALL the methods with the same name when I
inherited one? Is this true or does the source below generates a bug?
I had this problem running on compact framework, since the other framework
supports Write(decimal) on the binarywriter.
kind regards
Alexander
private static int X = 20041101;
private class MyWriter : BinaryWriter{
public MyWriter(Stream aStream) : base(aStream){}
/* since this is not added inside the pocket framework,
i kind added it myself. Storing it as double is not a problem,
since we are reading it as double*/
public void Write(decimal value){
Write(decimal.ToDouble(value));
}
}
private void button1_Click(object sender, System.EventArgs e) {
Stream S = new MemoryStream();
MyWriter W = new MyWriter(S);
W.Write(X);
label1.Text = S.Position.ToString();
}