public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value is string) { try { string s = (string)value; int colon = s.IndexOf(':'); int comma = s.IndexOf(','); if (colon != -1 && comma != -1) { bool ispagecache = Boolean.Parse(s.Substring(colon + 1, (comma - colon - 1))); colon = s.IndexOf(':', comma + 1); bool isbigtext = Boolean.Parse(s.Substring(colon + 1)); SpecialitySet op = new SpecialitySet(); op.PageCache = ispagecache; op.BigText = isbigtext; return(op); } } catch { throw new ArgumentException( "无法将“" + (string)value + "”转换为 SpellingOptions 类型"); } } return(base.ConvertFrom(context, culture, value)); }
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, System.Type destinationType) { if (destinationType == typeof(System.String) && value is SpecialitySet) { SpecialitySet op = (SpecialitySet)value; return("缓存:" + op.PageCache + ",大文本: " + op.BigText); } return(base.ConvertTo(context, culture, value, destinationType)); }
public AzClassCreatProperty(ObjDataPresentation objDataPresentation, SpecialitySet specialitySet) { ObjPresentation = objDataPresentation; //CtrSpecialitySet = specialitySet; }