コード例 #1
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            string str = value as string;

            if (!string.IsNullOrEmpty(str) && !this.IsQualifiedName(str))
            {
                return(XName.Get(str));
            }
            return(XNameTypeConverterHelper.ConvertFrom(context, value) ?? base.ConvertFrom(context, culture, value));
        }
コード例 #2
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            string stringValue = value as string;

            if (!string.IsNullOrEmpty(stringValue))
            {
                if (!IsQualifiedName(stringValue))
                {
                    // We want the name to remain unqualified; we don't want XNameTypeConverter to add the default namespace
                    return(XName.Get(stringValue));
                }
            }
            return(XNameTypeConverterHelper.ConvertFrom(context, value) ?? base.ConvertFrom(context, culture, value));
        }