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


C# this.Convert方法代码示例

本文整理汇总了C#中this.Convert方法的典型用法代码示例。如果您正苦于以下问题:C# this.Convert方法的具体用法?C# this.Convert怎么用?C# this.Convert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在this的用法示例。


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

示例1: ToScaledSmoothedCanny

 public static Image<Gray, byte> ToScaledSmoothedCanny(this Image<Bgr,byte> image)
 {
     Image<Gray, Byte> grayFrame = image.Convert<Gray, Byte>();
     Image<Gray, Byte> smallGrayFrame = grayFrame.PyrDown();
     Image<Gray, Byte> smoothedGrayFrame = smallGrayFrame.PyrUp();
     Image<Gray, Byte> cannyFrame = smoothedGrayFrame.Canny(new Gray(100), new Gray(60));
     return cannyFrame;
 }
开发者ID:genecyber,项目名称:PredatorCV,代码行数:8,代码来源:Canny.cs

示例2: Convert

        /// <summary>
        /// Extends Convert so that buffer offset of 0 and call to Array.Length are not needed.
        /// <example>
        /// decoder.Convert(bytes, chars, charIndex, charCount, flush, bytesUsed, charsUsed, completed);
        /// </example>
        /// </summary>
        public static void Convert(this Decoder decoder, Byte[] bytes, Char[] chars, Int32 charIndex, Int32 charCount, Boolean flush, out Int32 bytesUsed, out Int32 charsUsed, out Boolean completed)
        {
            if(decoder == null) throw new ArgumentNullException("decoder");

            if(bytes == null) throw new ArgumentNullException("bytes");

            decoder.Convert(bytes, 0, bytes.Length, chars, charIndex, charCount, flush, out bytesUsed, out charsUsed, out completed);
        }
开发者ID:peteraritchie,项目名称:ProductivityExtensions,代码行数:14,代码来源:Decoderable.g.cs

示例3: Convert

        /// <summary>
        /// Extends Convert so that buffer offset of 0 and call to Array.Length are not needed.
        /// <example>
        /// encoder.Convert(chars, bytes, byteIndex, byteCount, flush, charsUsed, bytesUsed, completed);
        /// </example>
        /// </summary>
        public static void Convert(this Encoder encoder, Char[] chars, Byte[] bytes, Int32 byteIndex, Int32 byteCount, Boolean flush, out Int32 charsUsed, out Int32 bytesUsed, out Boolean completed)
        {
            if(encoder == null) throw new ArgumentNullException("encoder");

            if(chars == null) throw new ArgumentNullException("chars");

            encoder.Convert(chars, 0, chars.Length, bytes, byteIndex, byteCount, flush, out charsUsed, out bytesUsed, out completed);
        }
开发者ID:peteraritchie,项目名称:ProductivityExtensions,代码行数:14,代码来源:Encoderable.g.cs

示例4: ConvertSafe

        /// <summary>
        /// Converts a value and handles typical bugs of Toolkit and official IValueConverters.
        /// </summary>
        /// <param name="vc"></param>
        /// <param name="value"></param>
        /// <param name="targetType"></param>
        /// <param name="parameter"></param>
        /// <param name="culture"></param>
        /// <returns></returns>
        public static object ConvertSafe(this IValueConverter vc, object value, Type targetType, object parameter, CultureInfo culture) 
        {
            // WP7 Toolkit's time converters have a bug where dates of different time zones are not properly
            // converted, and also crash the app. This fixes it.
            // See https://github.com/WFoundation/WF.Player.WinPhone/issues/23
            
            if (value is DateTime)
            {
                DateTime dtValue = (DateTime)value;

                // Lets the converter try converting the raw value.
                try
                {
                    vc.Convert(dtValue, targetType, parameter, culture);
                }
                catch (NotSupportedException)
                {
                    // Fix the value date time by converting it to local time.
                    DateTime fixedValue = dtValue.ToLocalTime();

                    // The conversion should be fine now.
                    try
                    {
                        return vc.Convert(fixedValue, targetType, parameter, culture);
                    }
                    catch (NotSupportedException)
                    {
                        // Despite all precautions, if the conversion still doesn't work, this probably means that 
                        // the date is still considered to be "in the future". Let's assume it's not too far from the present...
                        try
                        {
                            return vc.Convert(DateTime.Now, targetType, parameter, culture);
                        }
                        catch (Exception)
                        {
                            // Great despair, and nothing much to be done...
                            return null;
                        }
                    }    
                }   
            }

            // Let the wrapper converter handle other values.
            return vc.Convert(value, targetType, parameter, culture);
        }
开发者ID:chier01,项目名称:WF.Player.WinPhone,代码行数:54,代码来源:ConverterExtensions.cs

示例5: FromPersistence

 /// <summary>
 /// Converts persistence objects to immutable statistics objects
 /// </summary>
 /// <param name="dataArray">The persistence data objects.</param>
 /// <returns>array of statistics objects</returns>
 public static ExecutionStatistics[] FromPersistence(this ExecutionData[] dataArray)
 {
     return dataArray.Convert(
         d => new ExecutionStatistics(
             d.Name,
             d.OpenCount,
             d.CloseCount,
             d.Counters,
             d.RunningTime));
 }
开发者ID:pocheptsov,项目名称:lokad-shared-libraries,代码行数:15,代码来源:ConversionExtensions.cs

示例6: ColorLevel

 public static Image<Bgr, Byte> ColorLevel(this Image<Gray, Byte> src, ConnectLevel conn)
 {
     var dst = src.Convert<Bgr, Byte>();
     var color = new Bgr(0, 0, 255);
     foreach (var domain in conn.Domains) {
         foreach (var p in domain.Points) {
             dst[p.Y, p.X] = color;
         }
     }
     return dst;
 }
开发者ID:pakerliu,项目名称:sharp-context,代码行数:11,代码来源:Connectivity.cs

示例7: ToPersistence

 /// <summary>
 /// Converts immutable statistics objects to the persistence objects
 /// </summary>
 /// <param name="statisticsArray">The immutable statistics objects.</param>
 /// <returns>array of persistence objects</returns>
 public static ExecutionData[] ToPersistence(this ExecutionStatistics[] statisticsArray)
 {
     return statisticsArray.Convert(es => new ExecutionData
         {
             CloseCount = es.CloseCount,
             Counters = es.Counters,
             Name = es.Name,
             OpenCount = es.OpenCount,
             RunningTime = es.RunningTime
         });
 }
开发者ID:pocheptsov,项目名称:lokad-shared-libraries,代码行数:16,代码来源:ConversionExtensions.cs

示例8: ToListViewGroupData

        public static ListViewGroupedModel<ConsignDetail> ToListViewGroupData(this ConsignDto dto)
        {
            var lst = dto.Convert();
            var a = lst.ToLookup(l => l.Group)
                .Select(l => new ListViewGroup<ConsignDetail>(l) {
                    Title = l.Key,
                    ShortTitle = l.Key,

                });

            return new ListViewGroupedModel<ConsignDetail>() {
                Groups = new ObservableCollection<ListViewGroup<ConsignDetail>>(a)
            };
        }
开发者ID:jhy871167495,项目名称:LbcTest,代码行数:14,代码来源:ConsignDtoHelper.cs

示例9: Enumerable

		public static IEnsuring Enumerable(this IBooleanCondition<Type> condition)
		{
			var concreteCondition = condition.Convert<ConditionTree<Type>>();

			var isEnumerable = concreteCondition.Value.IsEnumerable();

			if (!concreteCondition.IsNegated)
			{
				if (!isEnumerable)
				{
					if (concreteCondition.IsArgument)
					{
						var defaultException = new ArgumentException("The type is not enumerable.", concreteCondition.ArgumentName);

						ConditionalException
							.Throw(defaultException, concreteCondition.Exception);
					}

					ConditionalException
						.Throw(new TypeIsNotEnumerableException(), concreteCondition.Exception);
				}
			}
			else
			{
				if (isEnumerable)
				{
					if (concreteCondition.IsArgument)
					{
						var defaultException = new ArgumentException("The type is enumerable.", concreteCondition.ArgumentName);

						ConditionalException
							.Throw(defaultException, concreteCondition.Exception);
					}

					ConditionalException
						.Throw(new TypeIsEnumerableException(), concreteCondition.Exception);
				}
			}

			return EnsuringWrapper.Create();
		}
开发者ID:matteomigliore,项目名称:HSDK,代码行数:41,代码来源:TypeConditionExtensions.cs

示例10: ToCairo

		public static global::Cairo.Color ToCairo(this IColor me)
		{
			Color.Bgra bgra = me.Convert<Color.Bgra>();
			return new global::Cairo.Color(bgra.Red / 255.0, bgra.Green / 255.0, bgra.Blue / 255.0, bgra.Alpha / 255.0);
		}
开发者ID:imintsystems,项目名称:Kean,代码行数:5,代码来源:ColorExtension.cs

示例11: ToNanos

 /// <summary>
 /// Convert the specified time duration in the given unit to the
 /// nanoseconds units.
 /// </summary>
 public static double ToNanos(this TimeUnit @from, long duration) {
   return @from.Convert(duration, TimeUnit.Nanoseconds);
 }
开发者ID:joethinh,项目名称:nohros-must,代码行数:7,代码来源:TimeUnit.cs

示例12: Convert

 public static object Convert(this IStepArgumentTypeConverter converter, object value, Type typeToConvertTo, CultureInfo cultureInfo)
 {
     return converter.Convert(value, new RuntimeBindingType(typeToConvertTo), cultureInfo);
 }
开发者ID:BEllis,项目名称:SpecFlow,代码行数:4,代码来源:StepExecutionTestsWithConversions.cs

示例13: AddColor

 public static Pen AddColor(this Pen pen, Color addColor, float percent)
 {
     return pen.Convert(pen.Color.AddColor(addColor, percent));
 }
开发者ID:CHiiLD,项目名称:net-toolkit,代码行数:4,代码来源:PenExtensions.cs

示例14: ToBlueGrayScale

 public static Pen ToBlueGrayScale(this Pen pen)
 {
     return pen.Convert(pen.Color.ToBlueGrayScale());
 }
开发者ID:CHiiLD,项目名称:net-toolkit,代码行数:4,代码来源:PenExtensions.cs

示例15: Call

 public static object Call(this IValueConverter converter, object value)
 {
     return converter.Convert(value, null, null, null);
 }
开发者ID:ZornTaov,项目名称:slimCat,代码行数:4,代码来源:ConverterTests.cs


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