This question is locked. New answers and comments are not allowed.
So I am using the schedule view control and have made a custom appointment type that extends Appointment.
everything goes well except when i try to take this object and serilize it to json so i can send it to my rest service.
i get the following error:
"Type 'System.TimeZoneInfo' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required."
here is how i am trying to serilize the object:
any ideas?
everything goes well except when i try to take this object and serilize it to json so i can send it to my rest service.
i get the following error:
"Type 'System.TimeZoneInfo' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required."
here is how i am trying to serilize the object:
public class Utils
{
public static string SerializeToJsonString(object objectToSerialize)
{
using (MemoryStream ms = new MemoryStream())
{
DataContractJsonSerializer serializer =
new DataContractJsonSerializer(objectToSerialize.GetType());
serializer.WriteObject(ms, objectToSerialize);
ms.Position = 0;
using (StreamReader reader = new StreamReader(ms))
{
return reader.ReadToEnd();
}
}
}
}
any ideas?