private Parse ( string contentType ) : string>.Dictionary |
||
contentType | string | |
return | string>.Dictionary |
private Dictionary<string, string> Parse(string contentType)
{
Dictionary<string, string> options = new Dictionary<string, string>();
string[] fields = contentType.Split(';');
for (int ii = 0; ii < fields.Length; ii++)
{
string key = String.Empty;
string value = null;
int index = fields[ii].IndexOf('=');
if (index != -1)
{
key = fields[ii].Substring(0, index).Trim();
value = fields[ii].Substring(index + 1).Trim();
value = value.Trim('"');
}
else
{
value = fields[ii].Trim();
}
options[key] = value;
}
return options;
}
}