serialization

D

douglas wittner

i am not sure if this is the correct place to post this; but can anyone tell
me why this class would not be serializable?
i can persist this in a blob so i am confident it would be serializable.
when i access via a web service i get:

"The 'taxValues' is of type TaxOutput, which does not support
serialization."

any help is great!
doug



[Serializable]
public class TaxOutput
{
private double _StateTax;
private double _CityTax;
private double _CountyTax;
private double _DistrictTax;
private double _totalTax;
private double _totalTaxRate;
private double _CityTaxRate;
private double _CountyTaxRate;
private double _StateTaxRate;
private double _DistrictTaxRate;

public double CityTax
{
get
{
return _CityTax;
}
set
{
_CityTax = value;
}
}
public double CountyTax
{
get
{
return _CountyTax;
}
set
{
_CountyTax = value;
}
}
public double DistrictTax
{
get
{
return _DistrictTax;

}
set
{
_DistrictTax = value;
}
}
public double StateTax
{
get
{
return _StateTax;
}
set
{
_StateTax = value;

}
}

public double TotalTax
{
get
{
return _totalTax;
}
set
{
_totalTax = value;
}
}

public double TotalTaxRate
{
get
{
return _totalTaxRate;

}
set
{
_totalTaxRate = value;
}
}

public double CityTaxRate
{
get
{
return _CityTaxRate;
}
set
{
_CityTaxRate = value;
}
}

public double CountyTaxRate
{
get
{
return _CountyTaxRate;
}
set
{
_CountyTaxRate = value;
}
}

public double DistrictTaxRate
{
get
{
return _DistrictTaxRate;
}
set
{
_DistrictTaxRate = value;
}
}

public double StateTaxRate
{
get
{
return _StateTaxRate;
}
set
{
_StateTaxRate = value;
}
}

}
 
T

Techno_Dex

The class looks fine. What are you using to Serialize the code when you
pass it across the wire? Do any of your property values contain characters
that would mess up the WebService serialization?
 
A

Andrew Brook

I haven't had to play around with serialization in a while, but i remember
something about only public member
variables being serialized, it looks like you only have public properties
based on private member variables so no data would be serialized (unless i'm
remembering incorrectly, and it wouldn't be the first time :)

Andrew

Techno_Dex said:
The class looks fine. What are you using to Serialize the code when you
pass it across the wire? Do any of your property values contain
characters that would mess up the WebService serialization?

douglas wittner said:
i am not sure if this is the correct place to post this; but can anyone
tell me why this class would not be serializable?
i can persist this in a blob so i am confident it would be serializable.
when i access via a web service i get:

"The 'taxValues' is of type TaxOutput, which does not support
serialization."

any help is great!
doug



[Serializable]
public class TaxOutput
{
private double _StateTax;
private double _CityTax;
private double _CountyTax;
private double _DistrictTax;
private double _totalTax;
private double _totalTaxRate;
private double _CityTaxRate;
private double _CountyTaxRate;
private double _StateTaxRate;
private double _DistrictTaxRate;

public double CityTax
{
get
{
return _CityTax;
}
set
{
_CityTax = value;
}
}
public double CountyTax
{
get
{
return _CountyTax;
}
set
{
_CountyTax = value;
}
}
public double DistrictTax
{
get
{
return _DistrictTax;

}
set
{
_DistrictTax = value;
}
}
public double StateTax
{
get
{
return _StateTax;
}
set
{
_StateTax = value;

}
}

public double TotalTax
{
get
{
return _totalTax;
}
set
{
_totalTax = value;
}
}

public double TotalTaxRate
{
get
{
return _totalTaxRate;

}
set
{
_totalTaxRate = value;
}
}

public double CityTaxRate
{
get
{
return _CityTaxRate;
}
set
{
_CityTaxRate = value;
}
}

public double CountyTaxRate
{
get
{
return _CountyTaxRate;
}
set
{
_CountyTaxRate = value;
}
}

public double DistrictTaxRate
{
get
{
return _DistrictTaxRate;
}
set
{
_DistrictTaxRate = value;
}
}

public double StateTaxRate
{
get
{
return _StateTaxRate;
}
set
{
_StateTaxRate = value;
}
}

}
 
T

Techno_Dex

douglas's code will work as is, it has more to do with the ability to set
the properties or member variables via public accessible ways. All the the
Deserialization is doing is instantiated a new object and settings the
variables. Now if he had a public getter on one of the properties but a
protected setter on the same property, then the object would serialze just
fine but when you go to deserialize the protected property would not get
set.

Andrew Brook said:
I haven't had to play around with serialization in a while, but i remember
something about only public member
variables being serialized, it looks like you only have public properties
based on private member variables so no data would be serialized (unless
i'm remembering incorrectly, and it wouldn't be the first time :)

Andrew

Techno_Dex said:
The class looks fine. What are you using to Serialize the code when you
pass it across the wire? Do any of your property values contain
characters that would mess up the WebService serialization?

douglas wittner said:
i am not sure if this is the correct place to post this; but can anyone
tell me why this class would not be serializable?
i can persist this in a blob so i am confident it would be serializable.
when i access via a web service i get:

"The 'taxValues' is of type TaxOutput, which does not support
serialization."

any help is great!
doug



[Serializable]
public class TaxOutput
{
private double _StateTax;
private double _CityTax;
private double _CountyTax;
private double _DistrictTax;
private double _totalTax;
private double _totalTaxRate;
private double _CityTaxRate;
private double _CountyTaxRate;
private double _StateTaxRate;
private double _DistrictTaxRate;

public double CityTax
{
get
{
return _CityTax;
}
set
{
_CityTax = value;
}
}
public double CountyTax
{
get
{
return _CountyTax;
}
set
{
_CountyTax = value;
}
}
public double DistrictTax
{
get
{
return _DistrictTax;

}
set
{
_DistrictTax = value;
}
}
public double StateTax
{
get
{
return _StateTax;
}
set
{
_StateTax = value;

}
}

public double TotalTax
{
get
{
return _totalTax;
}
set
{
_totalTax = value;
}
}

public double TotalTaxRate
{
get
{
return _totalTaxRate;

}
set
{
_totalTaxRate = value;
}
}

public double CityTaxRate
{
get
{
return _CityTaxRate;
}
set
{
_CityTaxRate = value;
}
}

public double CountyTaxRate
{
get
{
return _CountyTaxRate;
}
set
{
_CountyTaxRate = value;
}
}

public double DistrictTaxRate
{
get
{
return _DistrictTaxRate;
}
set
{
_DistrictTaxRate = value;
}
}

public double StateTaxRate
{
get
{
return _StateTaxRate;
}
set
{
_StateTaxRate = value;
}
}

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top