当前位置: 首页>>代码示例>>C#>>正文


C# IValueSerializerContext类代码示例

本文整理汇总了C#中IValueSerializerContext的典型用法代码示例。如果您正苦于以下问题:C# IValueSerializerContext类的具体用法?C# IValueSerializerContext怎么用?C# IValueSerializerContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IValueSerializerContext类属于命名空间,在下文中一共展示了IValueSerializerContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CanConvertToString

 /// <summary>
 /// Determines whether the specified object can be converted into a <see cref="String"/>.
 /// </summary>
 /// <param name="value">The object to evaluate for conversion.</param>
 /// <param name="context">Context information that is used for conversion.</param>
 /// <returns>
 /// <see langword="true"/> if the <paramref name="value"/> can be converted into a 
 /// <see cref="String"/>; otherwise, <see langword="false"/>.
 /// </returns>
 public override bool CanConvertToString(object value, IValueSerializerContext context)
 {
     var gesture = value as MultiKeyGesture;
     return gesture != null
            && ModifierKeysConverter.IsDefinedModifierKeys(gesture.Modifiers)
            && MultiKeyGestureConverter.IsDefinedKey(gesture.Key);
 }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:16,代码来源:MultiKeyGestureValueSerializer.cs

示例2: XamlObjectNodeIterator

		public XamlObjectNodeIterator (object root, XamlSchemaContext schemaContext, IValueSerializerContext vctx, XamlObjectReaderSettings settings)
		{
			ctx = schemaContext;
			this.root = root;
			value_serializer_ctx = vctx;
			this.settings = settings;
		}
开发者ID:wieslawsoltes,项目名称:Portable.Xaml,代码行数:7,代码来源:XamlObjectNodeIterator.cs

示例3: CanConvertToString

 /// <summary>
 /// Returns true if the given transform can be converted into a string
 /// </summary>
 public override bool CanConvertToString(object value, IValueSerializerContext context)
 {
     ImageSource imageSource = value as ImageSource;
     #pragma warning disable 6506
     return imageSource != null && imageSource.CanSerializeToString();
     #pragma warning restore 6506
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:10,代码来源:ImageSourceValueSerializer.cs

示例4: ConvertToString

 /// <summary>
 /// Converts a font family to a string.
 /// </summary>
 public override string ConvertToString(object value, IValueSerializerContext context)
 {
     FontFamily fontFamily = value as FontFamily;
     if (fontFamily == null || fontFamily.Source == null)
         throw GetConvertToException(value, typeof(string));
     return fontFamily.Source;
 }
开发者ID:JianwenSun,项目名称:cc,代码行数:10,代码来源:FontFamilyValueSerializer.cs

示例5: CanConvertToString

		public override bool CanConvertToString (object value, IValueSerializerContext context)
		{
			if (!(value is DateTime))
				throw new ArgumentException ("Can only convert objects of type 'DateTime'");

			return true;
		}
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:DateTimeValueSerializer.cs

示例6: CanConvertToString

 /// <summary>
 /// CanConvertToString()
 /// </summary>
 /// <param name="value"></param>
 /// <param name="context"></param>
 /// <returns></returns>
 /// <ExternalAPI/> 
 public override bool CanConvertToString(object value, IValueSerializerContext context) 
 {
     if (!(value is Key))
         return false;
     Key key = (Key)value;
     return ((int)key >= (int)Key.None && (int)key <= (int)Key.OemClear);
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:14,代码来源:KeyValueSerializer.cs

示例7: ConvertToString

 /// <summary>
 /// ConvertToString()
 /// </summary>
 /// <param name="value"></param>
 /// <param name="context"></param>
 /// <returns></returns>
 public override string ConvertToString(object value, IValueSerializerContext context) 
 {
     TypeConverter converter = TypeDescriptor.GetConverter(typeof(Key));
     if (converter != null)
         return converter.ConvertToInvariantString(value);
     else
         return base.ConvertToString(value, context);
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:14,代码来源:KeyValueSerializer.cs

示例8: ConvertFromString

		public override object ConvertFromString (string value, IValueSerializerContext context)
		{
			if (value == null)
				throw new NotSupportedException ();
			if (value.Length == 0)
				return DateTime.MinValue;
			return DateTime.Parse (value, CultureInfo.InvariantCulture, styles);
		}
开发者ID:Core2D,项目名称:Portable.Xaml,代码行数:8,代码来源:DateTimeValueSerializer.cs

示例9: ConvertFromString

        /// <summary>
        /// Converts a <see cref="String"/> to an instance of the type that the implementation of
        /// <see cref="ValueSerializer"/> supports.
        /// </summary>
        /// <param name="value">The string to convert.</param>
        /// <param name="context">Context information that is used for conversion.</param>
        /// <returns>
        /// A new instance of the type that the implementation of <see cref="ValueSerializer"/>
        /// supports based on the supplied <paramref name="value"/>.
        /// </returns>
        /// <exception cref="NotSupportedException">
        /// <paramref name="value"/> cannot be converted.
        /// </exception>
        public override object ConvertFromString(string value, IValueSerializerContext context)
        {
            var converter = TypeDescriptor.GetConverter(typeof(KeyGesture));
            if (converter != null)
                return converter.ConvertFromString(value);

            return base.ConvertFromString(value, context);
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:21,代码来源:MultiKeyGestureValueSerializer.cs

示例10: CanConvertToString

 public override bool CanConvertToString(object value, IValueSerializerContext context)
 {
     if (AttachablePropertyServices.GetAttachedPropertyCount(value) > 0)
     {
         return false;
     }
     return (((value != null) && (value is IValueSerializableExpression)) && ((IValueSerializableExpression) value).CanConvertToString(context));
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:ActivityWithResultValueSerializer.cs

示例11: ConvertFromString

 /// <summary>
 /// Creates a FontFamily from a string
 /// </summary>
 public override object ConvertFromString(string value, IValueSerializerContext context)
 {
     if (string.IsNullOrEmpty(value))
     {
         throw GetConvertFromException(value);
     }
     return new FontFamily(value);
 }
开发者ID:JianwenSun,项目名称:cc,代码行数:11,代码来源:FontFamilyValueSerializer.cs

示例12: ConvertFromString

 /// <summary>
 /// ConvertFromString()
 /// </summary>
 /// <param name="value"></param>
 /// <param name="context"></param>
 /// <returns></returns>
 public override object ConvertFromString(string value, IValueSerializerContext context) 
 {
     TypeConverter converter = TypeDescriptor.GetConverter(typeof(MouseAction));
     if (converter != null)
         return converter.ConvertFromString(value);
     else
         return base.ConvertFromString(value, context);
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:14,代码来源:MouseActionValueSerializer.cs

示例13: ConvertToStringWrapper

 internal static string ConvertToStringWrapper(object value, IValueSerializerContext context)
 {
     if (valueSerializer == null)
     {
         valueSerializer = new ActivityWithResultValueSerializer();
     }
     return valueSerializer.ConvertToString(value, context);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:ActivityWithResultValueSerializer.cs

示例14: ConvertFromString

		public override object ConvertFromString(string value, IValueSerializerContext context)
		{
			if (value != null)
			{
				return DataRect.Parse(value);
			}
			return base.ConvertFromString(value, context);
		}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:8,代码来源:DataRectSerializer.cs

示例15: ConvertToString

 /// <summary>
 /// Converts a transform into a string.
 /// </summary>
 public override string ConvertToString(object value, IValueSerializerContext context)
 {
     ImageSource imageSource = value as ImageSource;
     if (imageSource != null)
         return imageSource.ConvertToString(null,  System.Windows.Markup.TypeConverterHelper.InvariantEnglishUS);
     else
         return base.ConvertToString(value, context);
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:11,代码来源:ImageSourceValueSerializer.cs


注:本文中的IValueSerializerContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。