• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IConverter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ArmorConverter

        /// <summary>Initializes a new instance of the <see cref="ArmorConverter"/> class.</summary>
        /// <param name="converterFactory"></param>
        /// <param name="weightClassConverter">The converter for <see cref="WeightClass"/>.</param>
        /// <param name="infusionSlotCollectionConverter">The converter for <see cref="ICollection{InfusionSlot}"/>.</param>
        /// <param name="infixUpgradeConverter">The converter for <see cref="InfixUpgrade"/>.</param>
        public ArmorConverter(
            ITypeConverterFactory<ItemDTO, Armor> converterFactory,
            IConverter<string, WeightClass> weightClassConverter,
            IConverter<ICollection<InfusionSlotDTO>, ICollection<InfusionSlot>> infusionSlotCollectionConverter,
            IConverter<InfixUpgradeDTO, InfixUpgrade> infixUpgradeConverter)
            : this(converterFactory)
        {
            if (weightClassConverter == null)
            {
                throw new ArgumentNullException("weightClassConverter");
            }

            if (infusionSlotCollectionConverter == null)
            {
                throw new ArgumentNullException("infusionSlotCollectionConverter");
            }

            if (infixUpgradeConverter == null)
            {
                throw new ArgumentNullException("infixUpgradeConverter");
            }

            this.weightClassConverter = weightClassConverter;
            this.infusionSlotCollectionConverter = infusionSlotCollectionConverter;
            this.infixUpgradeConverter = infixUpgradeConverter;
        }
开发者ID:tigerbytes,项目名称:GW2.NET,代码行数:31,代码来源:ArmorConverter.cs


示例2: CompetitiveMapConverter

        /// <summary>Initializes a new instance of the <see cref="CompetitiveMapConverter"/> class.</summary>
        /// <param name="converterFactory"></param>
        /// <param name="scoreboardConverter">The converter for <see cref="Scoreboard"/>.</param>
        /// <param name="objectiveConverter">The converter for <see cref="Objective"/>.</param>
        /// <param name="mapBonusConverter">The converter for <see cref="MapBonus"/>.</param>
        public CompetitiveMapConverter(
            ITypeConverterFactory<CompetitiveMapDTO, CompetitiveMap> converterFactory,
            IConverter<int[], Scoreboard> scoreboardConverter,
            IConverter<ObjectiveDTO, Objective> objectiveConverter,
            IConverter<MapBonusDTO, MapBonus> mapBonusConverter)
            : this(converterFactory)
        {
            if (scoreboardConverter == null)
            {
                throw new ArgumentNullException("scoreboardConverter");
            }

            if (objectiveConverter == null)
            {
                throw new ArgumentNullException("objectiveConverter");
            }

            if (mapBonusConverter == null)
            {
                throw new ArgumentNullException("mapBonusConverter");
            }

            this.scoreboardConverter = scoreboardConverter;
            this.objectiveConverter = objectiveConverter;
            this.mapBonusConverter = mapBonusConverter;
        }
开发者ID:tigerbytes,项目名称:GW2.NET,代码行数:31,代码来源:CompetitiveMapConverter.cs


示例3: UpgradeComponentConverter

        /// <summary>Initializes a new instance of the <see cref="UpgradeComponentConverter"/> class.</summary>
        /// <param name="converterFactory"></param>
        /// <param name="upgradeComponentFlagCollectionConverter">The converter for <see cref="UpgradeComponentFlags"/>.</param>
        /// <param name="infusionSlotFlagCollectionConverter">The converter for <see cref="ICollection{InfusionSlotFlags}"/>.</param>
        /// <param name="infixUpgradeConverter">The converter for <see cref="InfixUpgrade"/>.</param>
        public UpgradeComponentConverter(
            ITypeConverterFactory<ItemDTO, UpgradeComponent> converterFactory,
            IConverter<ICollection<string>, UpgradeComponentFlags> upgradeComponentFlagCollectionConverter,
            IConverter<ICollection<string>, InfusionSlotFlags> infusionSlotFlagCollectionConverter,
            IConverter<InfixUpgradeDTO, InfixUpgrade> infixUpgradeConverter)
            : this(converterFactory)
        {
            if (upgradeComponentFlagCollectionConverter == null)
            {
                throw new ArgumentNullException("upgradeComponentFlagCollectionConverter");
            }

            if (infusionSlotFlagCollectionConverter == null)
            {
                throw new ArgumentNullException("infusionSlotFlagCollectionConverter");
            }

            if (infixUpgradeConverter == null)
            {
                throw new ArgumentNullException("infixUpgradeConverter");
            }

            this.upgradeComponentFlagCollectionConverter = upgradeComponentFlagCollectionConverter;
            this.infusionSlotFlagCollectionConverter = infusionSlotFlagCollectionConverter;
            this.infixUpgradeConverter = infixUpgradeConverter;
        }
开发者ID:tigerbytes,项目名称:GW2.NET,代码行数:31,代码来源:UpgradeComponentConverter.cs


示例4: QuestionsService

        public QuestionsService(IStatRepository<Stat> statRepository, IRepository<Word> wordRepository, IConverter converter)
        {
            this.statRepository = statRepository;
            this.wordRepository = wordRepository;

            this.converter = converter;
        }
开发者ID:neodenit,项目名称:active-reader,代码行数:7,代码来源:QuestionsService.cs


示例5: BuildService

 /// <summary>Initializes a new instance of the <see cref="BuildService"/> class.</summary>
 /// <param name="serviceClient">The service client.</param>
 /// <param name="converterForBuild">The converter for <see cref="Build"/>.</param>
 internal BuildService(IServiceClient serviceClient, IConverter<BuildDataContract, Build> converterForBuild)
 {
     Debug.Assert(serviceClient != null, "serviceClient != null");
     Debug.Assert(converterForBuild != null, "converterForBuild != null");
     this.serviceClient = serviceClient;
     this.converterForBuild = converterForBuild;
 }
开发者ID:gitter-badger,项目名称:GW2.NET,代码行数:10,代码来源:BuildService.cs


示例6: LetteraMessageService

 public LetteraMessageService(IMessaggisticaService messaggisticaService, IConfigurationMessageService configurationService, IConverter converter, IDaoFactory daoFactory)
 {
     _messaggisticaService = messaggisticaService;
     _configurationService = configurationService;
     _converter = converter;
     _daoFactory = daoFactory;
 }
开发者ID:gipasoft,项目名称:Sfera,代码行数:7,代码来源:LetteraMessageService.cs


示例7: AddNode

        public override INode AddNode(INode currentParent, IConverter converter)
        {
            //If the current parent is neither the root nor a group
            if(!(currentParent is IMotherNode))
                throw new ArgumentException("Trying to insert an 'AS' node, but the current node's type '" + currentParent.GetType() + "' is illegal. " + CheckString);

            GroupNode group;

            //If the current parent is the root
            if (currentParent is RootNode)
            {
                group = (currentParent as IMotherNode).Children.Last() as GroupNode;
                if (group == null)
                    throw new ArgumentException("Trying to insert an 'AS' node, but no Group found at root nor in its children. " + CheckString);
            }
            // The current parent is the group
            else if (currentParent is GroupNode)
                group = currentParent as GroupNode;
            // The group is the last child of the current parent
            else if ((currentParent as IMotherNode).Children.Last() is GroupNode)
                group = (currentParent as IMotherNode).Children.Last() as GroupNode;
            else
                throw new ArgumentException("Trying to insert an 'AS' node, but the current node is neither a group nor contains a group as children. " + CheckString);

            if (converter != null && converter.Function != null && converter.Function.Arguments != null && converter.Function.Arguments.Any())
                group.Name = converter.Function.Arguments[0].ToString();

            return currentParent;
        }
开发者ID:Timothep,项目名称:SimpleExpressions,代码行数:29,代码来源:AsBuilder.cs


示例8: AddNode

        public override INode AddNode(INode currentParent, IConverter converter)
        {
            INode orNode = new OrNode(converter);

            //// First element of a chain
            //if (currentParent is RootNode)
            //    throw new NotImplementedException("Or cannot be the first element");

            // Insert at root
            if (currentParent is RootNode)
            {
                var root = (currentParent as RootNode);
                var firstChild = root.Children.First();
                firstChild.Parent = orNode;
                (orNode as OrNode).Children.Add(firstChild);
                orNode.Parent = root;
                root.Children.Remove(firstChild);
            }
            // Insert before its parent
            else if (currentParent.Parent != null && currentParent.Parent as IMotherNode != null)
            {
                var grandParent = currentParent.Parent as IMotherNode;
                grandParent.Children.Remove(currentParent);
                (orNode as OrNode).Children.Add(currentParent);
                currentParent = currentParent.Parent;
            }

            this.LinkNodeToParent(currentParent, orNode);
            return orNode;
        }
开发者ID:Timothep,项目名称:SimpleExpressions,代码行数:30,代码来源:OrBuilder.cs


示例9: ArtistPageViewModel

        public ArtistPageViewModel(
            INavigationService navigationService,
            ILibraryService libraryService,
            IEnumerable<IMetadataProvider> metadataProviders,
            IConverter<WebAlbum, Album> webAlbumConverter,
            IConverter<WebArtist, Artist> webArtistConverter,
            IConverter<WebSong, Track> webSongConverter,
            ISettingsUtility settingsUtility)
        {
            _navigationService = navigationService;
            _libraryService = libraryService;
            _webAlbumConverter = webAlbumConverter;
            _metadataProviders = metadataProviders.FilterAndSort<IExtendedMetadataProvider>();

            _webArtistConverter = webArtistConverter;
            _webSongConverter = webSongConverter;
            _settingsUtility = settingsUtility;

            AlbumClickCommand = new DelegateCommand<ItemClickEventArgs>(AlbumClickExecute);
            WebAlbumClickCommand = new DelegateCommand<ItemClickEventArgs>(WebAlbumClickExecute);

            if (IsInDesignMode)
            {
                OnNavigatedTo("Childish Gambino", NavigationMode.New, new Dictionary<string, object>());
            }
        }
开发者ID:haroldma,项目名称:Audiotica,代码行数:26,代码来源:ArtistPageViewModel.cs


示例10: ItemConverter

        /// <summary>Initializes a new instance of the <see cref="ItemConverter"/> class.</summary>
        /// <param name="converterFactory"></param>
        /// <param name="itemRarityConverter">The converter for <see cref="ItemRarity"/>.</param>
        /// <param name="gameTypesConverter">The converter for <see cref="GameTypes"/>.</param>
        /// <param name="itemFlagsConverter">The converter for <see cref="ItemFlags"/>.</param>
        /// <param name="itemRestrictionsConverter">The converter for <see cref="ItemRestrictions"/>.</param>
        public ItemConverter(
            ITypeConverterFactory<ItemDTO, Item> converterFactory,
            IConverter<string, ItemRarity> itemRarityConverter,
            IConverter<ICollection<string>, GameTypes> gameTypesConverter,
            IConverter<ICollection<string>, ItemFlags> itemFlagsConverter,
            IConverter<ICollection<string>, ItemRestrictions> itemRestrictionsConverter)
            : this(converterFactory)
        {
            if (itemRarityConverter == null)
            {
                throw new ArgumentNullException("itemRarityConverter");
            }

            if (gameTypesConverter == null)
            {
                throw new ArgumentNullException("gameTypesConverter");
            }

            if (itemFlagsConverter == null)
            {
                throw new ArgumentNullException("itemFlagsConverter");
            }

            if (itemRestrictionsConverter == null)
            {
                throw new ArgumentNullException("itemRestrictionsConverter");
            }

            this.itemRarityConverter = itemRarityConverter;
            this.gameTypesConverter = gameTypesConverter;
            this.itemFlagsConverter = itemFlagsConverter;
            this.itemRestrictionsConverter = itemRestrictionsConverter;
        }
开发者ID:tigerbytes,项目名称:GW2.NET,代码行数:39,代码来源:ItemConverter.cs


示例11: WeaponConverter

        /// <summary>Initializes a new instance of the <see cref="WeaponConverter"/> class.</summary>
        /// <param name="converterFactory"></param>
        /// <param name="damageTypeConverter"></param>
        /// <param name="infusionSlotCollectionConverter"></param>
        /// <param name="infixUpgradeConverter"></param>
        public WeaponConverter(
            ITypeConverterFactory<ItemDTO, Weapon> converterFactory,
            IConverter<string, DamageType> damageTypeConverter,
            IConverter<ICollection<InfusionSlotDTO>, ICollection<InfusionSlot>> infusionSlotCollectionConverter,
            IConverter<InfixUpgradeDTO, InfixUpgrade> infixUpgradeConverter)
            : this(converterFactory)
        {
            if (damageTypeConverter == null)
            {
                throw new ArgumentNullException("damageTypeConverter");
            }

            if (infixUpgradeConverter == null)
            {
                throw new ArgumentNullException("infixUpgradeConverter");
            }

            if (infusionSlotCollectionConverter == null)
            {
                throw new ArgumentNullException("infusionSlotCollectionConverter");
            }

            this.damageTypeConverter = damageTypeConverter;
            this.infixUpgradeConverter = infixUpgradeConverter;
            this.infusionSlotCollectionConverter = infusionSlotCollectionConverter;
        }
开发者ID:tigerbytes,项目名称:GW2.NET,代码行数:31,代码来源:WeaponConverter.cs


示例12: EntityBindingDetail

 /// <summary>
 /// Initializes a new instance of the <see cref="EntityBindingDetail"/> class.
 /// </summary>
 /// <param name="entityProperty">The entity property.</param>
 /// <param name="valueKey">The value key.</param>
 /// <param name="converter">The converter.</param>
 /// <param name="bindingType">Type of the binding.</param>
 public EntityBindingDetail(PropertyInfo entityProperty, string valueKey, IConverter converter, BindingType bindingType)
 {
     this.EntityProperty = entityProperty;
     this.ValueKey = valueKey;
     this.Converter = converter;
     this.BindingType = bindingType;
 }
开发者ID:GAlexandreBastien,项目名称:Dynamite-2010,代码行数:14,代码来源:EntityBindingDetail.cs


示例13: LoadConverter

 private static void LoadConverter()
 {
     if (_converter == null)
     {
         _converter = (IConverter)Activator.CreateInstance(ConfigurationManager.Converter.Type);
     }
 }
开发者ID:footprint4me,项目名称:objectpool,代码行数:7,代码来源:TypeConverter.cs


示例14: RecipeConverter

        /// <summary>Initializes a new instance of the <see cref="RecipeConverter"/> class.</summary>
        /// <param name="converterFactory"></param>
        /// <param name="craftingDisciplineCollectionConverter">The converter for <see cref="CraftingDisciplines"/>.</param>
        /// <param name="recipeFlagCollectionConverter">The converter for <see cref="RecipeFlags"/>.</param>
        /// <param name="itemQuantityCollectionConverter">The converter for <see cref="T:ICollection{ItemQuantity}"/>.</param>
        public RecipeConverter(
            ITypeConverterFactory<RecipeDTO, Recipe> converterFactory,
            IConverter<ICollection<string>, CraftingDisciplines> craftingDisciplineCollectionConverter,
            IConverter<ICollection<string>, RecipeFlags> recipeFlagCollectionConverter,
            IConverter<ICollection<IngredientDTO>, ICollection<ItemQuantity>> itemQuantityCollectionConverter)
            : this(converterFactory)
        {
            if (craftingDisciplineCollectionConverter == null)
            {
                throw new ArgumentNullException("craftingDisciplineCollectionConverter");
            }

            if (recipeFlagCollectionConverter == null)
            {
                throw new ArgumentNullException("recipeFlagCollectionConverter");
            }

            if (itemQuantityCollectionConverter == null)
            {
                throw new ArgumentNullException("itemQuantityCollectionConverter");
            }

            this.craftingDisciplineCollectionConverter = craftingDisciplineCollectionConverter;
            this.recipeFlagCollectionConverter = recipeFlagCollectionConverter;
            this.itemQuantityCollectionConverter = itemQuantityCollectionConverter;
        }
开发者ID:Waevka,项目名称:GW2.NET,代码行数:31,代码来源:RecipeConverter.cs


示例15: ScheduleIndexJobs

 public ScheduleIndexJobs(SourceStorageFactory sourceStorageFactory, IScheduler scheduler)
 {
     _sourceStorageFactory = sourceStorageFactory;
     _scheduler = scheduler;
     Sources = new IItemSource[] { };
     Converters = new IConverter[] { };
 }
开发者ID:brunomlopes,项目名称:ILoveLucene,代码行数:7,代码来源:ScheduleIndexJobs.cs


示例16: TestConversion

        public static void TestConversion(IConverter converter, string sourceFileName, FileTypes sourceFormat, FileTypes targetFormat, bool assertSuccess)
        {
            string sourceFile = Path.GetFullPath(sourceFileName);

            // Get a temporary target file
            TempFolder tempFolder = new TempFolder();
            string targetFile = tempFolder.getFilePath("target." + targetFormat);

            // Do the conversion
            bool converted = converter.Convert(sourceFile, (int)sourceFormat, targetFile, (int)targetFormat);

            if (assertSuccess)
            {
                // Check that converter returned true
                Assert.IsTrue(converted);
                // Check that converter created the target file and it's not empty
                Assert.AreNotEqual(0, new FileInfo(targetFile).Length);
            }
            else
            {
                // Check that converter returned false
                Assert.IsFalse(converted);
            }

            // Delete the temp folder created
            tempFolder.Release();
        }
开发者ID:sbxlmdsl,项目名称:MateCat-Win-Converter,代码行数:27,代码来源:ConversionTestHelper.cs


示例17: AzureTableServiceContext

 public AzureTableServiceContext(string baseAddress, StorageCredentials credentials, IConverter converter)
     : base(baseAddress, credentials)
 {
     _converter = converter;
     WritingEntity += OnWritingEntity;
     ReadingEntity += OnReadingEntity;
 }
开发者ID:bobasoft,项目名称:framework,代码行数:7,代码来源:AzureTableServiceContext.cs


示例18: GetConversionCost

        /// <inheritdoc />
        public ConversionCost GetConversionCost(Type sourceType, Type targetType, IConverter elementConverter)
        {
            if (typeof(string).IsAssignableFrom(sourceType))
                return elementConverter.GetConversionCost(typeof(XmlDocument), targetType).Add(ConversionCost.Typical);

            return ConversionCost.Invalid;
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:8,代码来源:StringToXmlDocumentConversionRule.cs


示例19: Add

 public void Add(IConverter converter)
 {
     if (Converter.ContainsKey(converter.Type))
         Converter[converter.Type] = converter;
     else
         Converter.Add(converter.Type, converter);
 }
开发者ID:Platzer,项目名称:ShellFx,代码行数:7,代码来源:Converter.cs


示例20: ConvertToStringFormattingRule

        /// <summary>
        /// Creates a conversion to string formatting rule.
        /// </summary>
        /// <param name="converter">The converter to use.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="converter"/> is null.</exception>
        public ConvertToStringFormattingRule(IConverter converter)
        {
            if (converter == null)
                throw new ArgumentNullException("converter");

            this.converter = converter;
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:12,代码来源:ConvertToStringFormattingRule.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IConvertible类代码示例发布时间:2022-05-24
下一篇:
C# IConversionManager类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap