public override string SerializeToString(object obj)
{
ICalendarParameter p = obj as ICalendarParameter;
if (p != null)
{
string result = p.Name + "=";
string value = string.Join(",", p.Values.ToArray());
// "Section 3.2: Property parameter values MUST NOT contain the DQUOTE character."
// Therefore, let's strip any double quotes from the value.
value = value.Replace("\"", string.Empty);
// Surround the parameter value with double quotes, if the value
// contains any problematic characters.
if (value.IndexOfAny(new char[] { ';', ':', ',' }) >= 0)
value = "\"" + value + "\"";
return result + value;
}
return string.Empty;
}