System.Configuration.TypeNameConverter.ConvertTo C# (CSharp) Метод

ConvertTo() публичный Метод

public ConvertTo ( ITypeDescriptorContext ctx, CultureInfo ci, object value, Type type ) : object
ctx ITypeDescriptorContext
ci CultureInfo
value object
type System.Type
Результат object
        public override object ConvertTo(ITypeDescriptorContext ctx, CultureInfo ci, object value, Type type) {
            // Make the check here since for some reason value.GetType is not System.Type but RuntimeType
            if (!(value is Type)) {
                ValidateType(value, typeof(Type));
            }

            string result = null;

            if (value != null) {
                result = ((Type)value).AssemblyQualifiedName;
            }

            return result;
        }

Usage Example

Пример #1
0
		public void ConvertTo ()
		{
			TypeNameConverter cv = new TypeNameConverter ();

			Assert.AreEqual (typeof (string).AssemblyQualifiedName, cv.ConvertTo (null, null, typeof (string), typeof (string)), "A1");
		}
All Usage Examples Of System.Configuration.TypeNameConverter::ConvertTo
TypeNameConverter