コード例 #1
0
        public override bool Equals(object obj)
        {
            ThisAssemblyConvertable o = obj as ThisAssemblyConvertable;

            if (o == null)
            {
                return(false);
            }
            return(this.name.Equals(o.name) && this.value.Equals(o.value));
        }
コード例 #2
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            if (value.GetType() != typeof(string))
            {
                throw new Exception("value not string");
            }

            string serialised = (string)value;

            string [] parts = serialised.Split('\t');

            if (parts.Length != 2)
            {
                throw new Exception("string in incorrect format");
            }

            ThisAssemblyConvertable convertable = new ThisAssemblyConvertable(parts [0], parts [1]);

            return(convertable);
        }
コード例 #3
0
		public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
		{
			if (value.GetType () != typeof (string))
				throw new Exception ("value not string");

			string serialised = (string) value;

			string [] parts = serialised.Split ('\t');

			if (parts.Length != 2)
				throw new Exception ("string in incorrect format");

			ThisAssemblyConvertable convertable = new ThisAssemblyConvertable (parts [0], parts [1]);
			return convertable;
		}