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

C# Keyword类代码示例

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

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



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

示例1: Create

 public IHttpActionResult Create(Keyword keyword)
 {
     var createdKeyword = KeywordLogic.CreateKeyword(keyword);
     if (createdKeyword == null)
         return Conflict();
     return Ok(createdKeyword);
 }
开发者ID:BlueInt32,项目名称:video-library,代码行数:7,代码来源:KeywordController.cs


示例2: Map

        public JsonKeyword Map(Keyword keyword)
        {
            switch (keyword)
            {
                case Keyword.Given:
                {
                    return JsonKeyword.Given;
                }

                case Keyword.When:
                {
                    return JsonKeyword.When;
                }

                case Keyword.Then:
                {
                    return JsonKeyword.Then;
                }

                case Keyword.And:
                {
                    return JsonKeyword.And;
                }

                case Keyword.But:
                {
                    return JsonKeyword.But;
                }

                default:
                    throw new ArgumentOutOfRangeException(nameof(keyword), keyword, null);
            }
        }
开发者ID:picklesdoc,项目名称:pickles,代码行数:33,代码来源:KeywordToJsonKeywordMapper.cs


示例3: UpdateKeywordIsPersisted

        public void UpdateKeywordIsPersisted()
        {
            using (var businessContext = new BusinessContext())
            {
                var language = new Language
                {
                    Name = "LanguageName"
                };

                businessContext.AddNewLanguage(language);

                var keyword = new Keyword
                {
                    Name = "KeywordName",
                    LanguageId = 1,
                };

                businessContext.AddNewKeyword(keyword);

                keyword.Name = "New KeywordName";

                businessContext.UpdateKeyword(keyword);

                bool updated = businessContext.DataContext.Keywords.Any(k => k.Id == keyword.Id && k.Name == keyword.Name);

                Assert.IsTrue(updated);
            }
        }
开发者ID:Woodje,项目名称:DaCoder,代码行数:28,代码来源:KeywordScenarioTests.cs


示例4: DeleteKeywordIsPersisted

        public void DeleteKeywordIsPersisted()
        {
            using (var businessContext = new BusinessContext())
            {
                var language = new Language
                {
                    Name = "LanguageName"
                };

                businessContext.AddNewLanguage(language);

                var keyword = new Keyword
                {
                    Name = "KeywordName",
                    LanguageId = 1,
                };

                businessContext.AddNewKeyword(keyword);

                //businessContext.DeleteKeyword(keyword);

                bool notDeleted = businessContext.DataContext.Keywords.Any(k => k.Id == keyword.Id);

                //Assert.IsFalse(notDeleted);
            }
        }
开发者ID:Woodje,项目名称:DaCoder,代码行数:26,代码来源:KeywordScenarioTests.cs


示例5: EasyTraceEvent

 // EasyTraceEvent
 // Checks the keyword and level before emiting the event
 static internal void EasyTraceEvent(Keyword keywords, Level level, Event eventID)
 {
     if (IsEnabled(keywords, level))
     {
         EventProvider.TraceEvent(eventID, keywords, level);
     }
 }
开发者ID:JianwenSun,项目名称:cc,代码行数:9,代码来源:Trace.cs


示例6: Test

		public void Test()
		{
			IDriver driver = sessions.ConnectionProvider.Driver;
			if (!driver.SupportsMultipleQueries)
			{
				Assert.Ignore("Driver {0} does not support multi-queries", driver.GetType().FullName);
			}
			
			using (ISession session = sessions.OpenSession())
			using (ITransaction transaction = session.BeginTransaction())
			{
				_keyword = new Keyword();
				session.Save(_keyword);

				NodeKeyword nodeKeyword = new NodeKeyword();
				nodeKeyword.NodeId = 1;
				nodeKeyword.Keyword = _keyword;
				session.Save(nodeKeyword);

				transaction.Commit();
			}

			using (ISession session = sessions.OpenSession())
			{
				//If uncomment the line below the test will pass
				//GetResult(session);
				IList result = GetResult(session);
				Assert.That(result, Has.Count.EqualTo(2));
				Assert.That(result[0], Has.Count.EqualTo(1));
				Assert.That(result[1], Has.Count.EqualTo(1));
			}
		}
开发者ID:juanplopes,项目名称:nhibernate,代码行数:32,代码来源:Fixture.cs


示例7: Run

    /// <summary>
    /// Runs the code example.
    /// </summary>
    /// <param name="user">The AdWords user.</param>
    /// <param name="adGroupId">Id of the ad group to which keywords are added.
    /// </param>
    public void Run(AdWordsUser user, long adGroupId) {
      // Get the AdGroupCriterionService.
      AdGroupCriterionService adGroupCriterionService =
          (AdGroupCriterionService) user.GetService(
              AdWordsService.v201509.AdGroupCriterionService);

      List<AdGroupCriterionOperation> operations = new List<AdGroupCriterionOperation>();

      foreach (string keywordText in KEYWORDS) {
        // Create the keyword.
        Keyword keyword = new Keyword();
        keyword.text = keywordText;
        keyword.matchType = KeywordMatchType.BROAD;

        // Create the biddable ad group criterion.
        BiddableAdGroupCriterion keywordCriterion = new BiddableAdGroupCriterion();
        keywordCriterion.adGroupId = adGroupId;
        keywordCriterion.criterion = keyword;

        // Optional: Set the user status.
        keywordCriterion.userStatus = UserStatus.PAUSED;

        // Optional: Set the keyword destination url.
        keywordCriterion.finalUrls = new UrlList() {
          urls = new string[] { "http://example.com/mars/cruise/?kw=" +
              HttpUtility.UrlEncode(keywordText) }
        };

        // Create the operations.
        AdGroupCriterionOperation operation = new AdGroupCriterionOperation();
        [email protected] = Operator.ADD;
        operation.operand = keywordCriterion;

        operations.Add(operation);
      }
      try {
        // Create the keywords.
        AdGroupCriterionReturnValue retVal = adGroupCriterionService.mutate(operations.ToArray());

        // Display the results.
        if (retVal != null && retVal.value != null) {
          foreach (AdGroupCriterion adGroupCriterion in retVal.value) {
            // If you are adding multiple type of criteria, then you may need to
            // check for
            //
            // if (adGroupCriterion is Keyword) { ... }
            //
            // to identify the criterion type.
            Console.WriteLine("Keyword with ad group id = '{0}', keyword id = '{1}', text = " +
                "'{2}' and match type = '{3}' was created.", adGroupCriterion.adGroupId,
                adGroupCriterion.criterion.id, (adGroupCriterion.criterion as Keyword).text,
                (adGroupCriterion.criterion as Keyword).matchType);
          }
        } else {
          Console.WriteLine("No keywords were added.");
        }
      } catch (Exception e) {
        throw new System.ApplicationException("Failed to create keywords.", e);
      }
    }
开发者ID:markgmarkg,项目名称:googleads-dotnet-lib,代码行数:66,代码来源:AddKeywords.cs


示例8: TryGetKeyword

        public bool TryGetKeyword(string categoryUriToLookIn, string keywordName, out IKeyword keyword)
        {
            using (var client = new TridionBrokerServiceClient())
            {
                string result = client.GetKeywordHierarchy(categoryUriToLookIn, keywordName);
                if (!string.IsNullOrEmpty(result))
                {
                    XElement keyWord = XElement.Parse(result);
                    var tkeyword = new Keyword()
                    {
                        Id = keyWord.Element("Uri").Value,
                        Title = keyWord.Element("KeywordName").Value,
                        TaxonomyId = keyWord.Element("TaxonomyUri").Value
                    };
                    foreach (XElement parentElement in keyWord.Element("ParentKeywords").Elements())
                    {
                        tkeyword.ParentKeywords.Add(
                            new Keyword
                            {
                                Id = parentElement.Attribute("Uri").Value,
                                Title = parentElement.Value,
                                TaxonomyId = parentElement.Attribute("TaxonomyUri").Value
                            }
                        );
                    }
                    keyword = tkeyword;
                    return true;
                }
            }

            keyword = null;
            return false;
        }
开发者ID:rainmaker2k,项目名称:TridionMVCDotNet,代码行数:33,代码来源:WebServiceTaxonomyFactory.cs


示例9: AddKeywordNode

        /// <summary>
        /// Adds a new keyword xml node to a <see cref="T:System.Xml.XmlNode" />
        /// </summary>
        /// <param name="node"><see cref="T:System.Xml.XmlNode" /></param>
        /// <param name="name">xml Node Name</param>
        /// <param name="value"><see cref="T:Tridion.ContentManager.ContentManagement.Keyword" /></param>
        /// <param name="includeLevel">if set to <c>true</c> [include level].</param>
        /// <returns>
        ///   <see cref="T:System.Xml.XmlElement" /> keyword node
        /// </returns>
        public static XmlElement AddKeywordNode(this XmlNode node, String name, Keyword value, bool includeLevel)
        {
            if (node != null && !String.IsNullOrEmpty(name) && node.OwnerDocument != null && value != null)
            {
                XmlElement xElement = node.OwnerDocument.CreateElement(name);
                xElement.SetAttribute("uri", value.Id);

                if (!String.IsNullOrEmpty(value.Key))
                    xElement.SetAttribute("key", value.Key);

                if (!String.IsNullOrEmpty(value.Description))
                    xElement.SetAttribute("description", value.Description);

                xElement.SetAttribute("root", value.IsRoot.ToString().ToLower());

                if (includeLevel)
                    xElement.SetAttribute("level", value.Level().ToString());

                xElement.InnerXml = SecurityElement.Escape(value.Title);

                node.AppendChild(xElement);
                return xElement;
            }

            return null;
        }
开发者ID:TcmExtensions,项目名称:TcmTemplating,代码行数:36,代码来源:XmlNodeExtensions.cs


示例10: Test

		public void Test()
		{
			using (var session = sessions.OpenSession())
			using (var transaction = session.BeginTransaction())
			{
				_keyword = new Keyword();
				session.Save(_keyword);

				var nodeKeyword = new NodeKeyword();
				nodeKeyword.NodeId = 1;
				nodeKeyword.Keyword = _keyword;
				session.Save(nodeKeyword);

				transaction.Commit();
			}

			using (var session = sessions.OpenSession())
			{
				//If uncomment the line below the test will pass
				//GetResult(session);
				var result = GetResult(session);
				Assert.That(result, Has.Count.EqualTo(2));
				Assert.That(result[0], Has.Count.EqualTo(1));
				Assert.That(result[1], Has.Count.EqualTo(1));
			}
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:26,代码来源:Fixture.cs


示例11: ComputeArticleTfidf

        private List<Keyword> ComputeArticleTfidf(string content, int titleLength)
        {
            var tm = new HashMap<string, Keyword>();

            var parse = NlpAnalysis.Parse(content);
            foreach (var term in parse)
            {
                var weight = getWeight(term, content.Length, titleLength);
                if (weight == 0)
                    continue;
                var keyword = tm[term.Name];
                if (keyword == null)
                {
                    keyword = new Keyword(term.Name, term.Nature.allFrequency, weight);
                    tm[term.Name] = keyword;
                }
                else
                {
                    keyword.UpdateWeight(1);
                }
            }

            var treeSet = new SortedSet<Keyword>(tm.Values);

            var arrayList = new List<Keyword>(treeSet);
            if (treeSet.Count <= _keywordAmount)
            {
                return arrayList;
            }
            return arrayList.Take(_keywordAmount).ToList();
        }
开发者ID:echofool,项目名称:Ansj.Net,代码行数:31,代码来源:KeyWordComputer.cs


示例12: CaseExpr

 public CaseExpr( IPersistentMap sourceSpan, LocalBindingExpr expr, int shift, int mask, int low, int high, Expr defaultExpr,
     SortedDictionary<int, Expr> tests, Dictionary<int, Expr> thens, Keyword switchType, Keyword testType, IPersistentSet skipCheck)
 {
     _sourceSpan = sourceSpan;
     _expr = expr;
     _shift = shift;
     _mask = mask;
     //_low = low;
     //_high = high;
     _defaultExpr = defaultExpr;
     _tests = tests;
     _thens = thens;
     if (switchType != _compactKey && switchType != _sparseKey)
         throw new ArgumentException("Unexpected switch type: " + switchType);
     //_switchType = switchType;
     if (testType != _intKey && testType != _hashEquivKey && testType != _hashIdentityKey)
         throw new ArgumentException("Unexpected test type: " + testType);
     _testType = testType;
     _skipCheck = skipCheck;
     ICollection<Expr> returns = new List<Expr>(thens.Values);
     returns.Add(defaultExpr);
     _returnType = Compiler.MaybeClrType(returns);
     if (RT.count(skipCheck) > 0 && RT.booleanCast(RT.WarnOnReflectionVar.deref()))
     {
         RT.errPrintWriter().WriteLine("Performance warning, {0}:{1} - hash collision of some case test constants; if selected, those entries will be tested sequentially.",
             Compiler.SourcePathVar.deref(),RT.get(sourceSpan,RT.StartLineKey));
     }
 }
开发者ID:richhickey,项目名称:clojure-clr,代码行数:28,代码来源:CaseExpr.cs


示例13: addEntry

        /// <summary>
        ///     Add a new entry to one of the dropdown tables in the database.
        /// </summary>
        /// <param name="table">Table to add a new entry to.</param>
        /// <param name="entry">
        ///     DropdownEntry containing the value and code,
        ///     if exists.
        /// </param>
        public void addEntry(Constants.DropdownTable table,
                             DropdownEntry entry)
        {
            switch (table) {
                case Constants.DropdownTable.Keyword:
                    var kw = new Keyword {
                        KeywordValue = entry.value
                    };

                    _db.Keywords.InsertOnSubmit(kw);
                    break;
                case Constants.DropdownTable.QuestionType:
                    var qType = new QuestionType {
                        Code = entry.code,
                        Value = entry.value
                    };

                    _db.QuestionTypes.InsertOnSubmit(qType);

                    break;
                case Constants.DropdownTable.Region:
                    var region = new Region {
                        Code = entry.code,
                        Value = entry.value
                    };

                    _db.Regions.InsertOnSubmit(region);

                    break;
                case Constants.DropdownTable.RequestorType:
                    var rType = new RequestorType {
                        Code = entry.code,
                        Value = entry.value
                    };

                    _db.RequestorTypes.InsertOnSubmit(rType);

                    break;
                case Constants.DropdownTable.TumourGroup:
                    var tGroup = new TumourGroup {
                        Code = entry.code,
                        Value = entry.value
                    };

                    _db.TumourGroups.InsertOnSubmit(tGroup);

                    break;
                case Constants.DropdownTable.UserGroup:
                    var uGroup = new UserGroup {
                        Code = entry.code,
                        Value = entry.value
                    };

                    _db.UserGroups.InsertOnSubmit(uGroup);

                    break;
            }

            _db.SubmitChanges();
        }
开发者ID:vladzaharia,项目名称:cairs,代码行数:68,代码来源:DropdownManagementController.cs


示例14: Ongoing

 public Ongoing(Keyword keyword, EffectType effect_type, int modifier, int duration)
 {
     key = keyword;
     type = effect_type;
     mod = modifier;
     dur = duration;
 }
开发者ID:emotecontrol,项目名称:CSharpCombatTracker,代码行数:7,代码来源:Ongoing.cs


示例15: SetKeyword

 public void SetKeyword(string keywordText)
 {
     Keyword keyword;
     if (Enum.TryParse<Keyword>(keywordText, out keyword))
     {
         this.keyword = keyword;
     }
 }
开发者ID:MikeEast,项目名称:pickles,代码行数:8,代码来源:StepBuilder.cs


示例16: Add

 public void Add(int index, Keyword keyword, int topicCount)
 {
     if (_cache.Count > MaxItems)
         Clear();
     _index.Add(index);
     _cache.Add(keyword);
     _topicCount.Add(topicCount);
 }
开发者ID:bencz,项目名称:OrangeC,代码行数:8,代码来源:IndexCache.cs


示例17: StepResult

        public StepResult(Keyword keyword)
        {
            KeywordName = keyword.Name;

            Result = Result.CreateFail(string.Format("Can't find step '{0}'.</br>- - - - ->Step exists = {1}.\r\n Parameters are correct = {2}",
                keyword.Name,
                keyword.KeywordExists,
                keyword.ParametersAreCorrect));
        }
开发者ID:ihenehan,项目名称:Behavior,代码行数:9,代码来源:StepResult.cs


示例18: InteractionResult

        public InteractionResult(Keyword keyword)
        {
            KeywordName = keyword.Name;

            Result = Result.CreateFail(string.Format("Failure to access keyword {0}.\r\n Keyword exists = {1}.\r\n Parameters are correct = {2}",
                keyword.Name,
                keyword.KeywordExists,
                keyword.ParametersAreCorrect));
        }
开发者ID:ihenehan,项目名称:Behavior,代码行数:9,代码来源:InteractionResult.cs


示例19: NavigationNode

 internal NavigationNode(Keyword keyword)
 {
     Keyword = keyword;
     _keywordMeta = new XmlDocument();
     _keywordMeta.LoadXml(keyword.Metadata.OuterXml);
     _nm = new XmlNamespaceManager(new NameTable());
     _nm.AddNamespace("meta", keyword.MetadataSchema.NamespaceUri);
     _log = TemplatingLogger.GetLogger(GetType());
 }
开发者ID:mhassan26,项目名称:SDL-Tridion-Template-Tools,代码行数:9,代码来源:GetSiteNavigationXml-Keywords.cs


示例20: SetKeyword

        public void SetKeyword(string keywordText)
        {
            this.nativeKeyword = keywordText;

            Keyword? keyword = this.TryParseKeyword(keywordText);
            if (keyword.HasValue)
            {
                this.keyword = keyword.Value;
            }
        }
开发者ID:Jaykul,项目名称:pickles,代码行数:10,代码来源:StepBuilder.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Keywords类代码示例发布时间:2022-05-24
下一篇:
C# Keys类代码示例发布时间: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