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


C# ICollection.IsNullOrEmpty方法代码示例

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


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

示例1: BatchGeocodeRequest

		public BatchGeocodeRequest(string key, ICollection<string> addresses) 
			: base(key) 
		{
			if (addresses.IsNullOrEmpty())
				throw new ArgumentException("addresses can not be null or empty");

			Locations = (from l in addresses select new LocationRequest(l)).ToArray();
		}
开发者ID:yangkf1985,项目名称:Geocoding.net,代码行数:8,代码来源:BatchGeocodeRequest.cs

示例2: SetRouteValues

 private void SetRouteValues(ICollection<KeyValuePair<string, object>> values)
 {
     if (!values.IsNullOrEmpty())
     {
         siteMapNode.RouteValues.Clear();
         siteMapNode.RouteValues.AddRange(values);
     }
 }
开发者ID:timbooker,项目名称:telerikaspnetmvc,代码行数:8,代码来源:SiteMapNodeBuilder.cs

示例3: DeleteSnippetTags

        public bool DeleteSnippetTags(long snippetID, ICollection<string> tagsToDelete)
        {
            if ((snippetID <= 0) || tagsToDelete.IsNullOrEmpty())
            {
                SetLastError(log, ErrorCodes.WRONG_INPUT, 
                    string.Format("Input error: snippetID={0}, tags={1}", snippetID, tagsToDelete.Print<string>()));
                return false;
            }

            //send the request and parse the response:
            S2CSerializer ser = new S2CSerializer(m_serialFormat, snippetID);
            string contentToSend = "content=" + HttpUtility.UrlEncode(ser.SerializeListObj<string>(tagsToDelete.ToArray()));
            S2CResObj<object> resp = SendReqObj(DELETE_TAGS_URL, contentToSend, true);

            //build the result:
            return ParseBoolResponse(resp);
        }
开发者ID:modulexcite,项目名称:snip2codeNET,代码行数:17,代码来源:SnippetsWS.cs

示例4: SetRouteValues

 private void SetRouteValues(ICollection<KeyValuePair<string, object>> values)
 {
     if (!values.IsNullOrEmpty())
     {
         item.RouteValues.Clear();
         item.RouteValues.Merge(values);
     }
 }
开发者ID:timbooker,项目名称:telerikaspnetmvc,代码行数:8,代码来源:MenuItemBuilder.cs

示例5: UnPublishSnippet

        public bool UnPublishSnippet(long snippetID, ICollection<int> channelIDs)
        {
            // 1) check input validity:
            if ((snippetID <= 0) || channelIDs.IsNullOrEmpty())
            {
                SetLastError(log, ErrorCodes.WRONG_INPUT, string.Format("Input error: snippetID={0}; channelIDs={1}", snippetID, channelIDs.PrintNull()));
                return false;
            }

            // 2) remove the channels ID as a property of the snippet:
            foreach (int channelID in channelIDs)
            {
                if (!DeleteSnippetProperty(new SnippetProperty(DefaultProperty.Channel, channelID + "", snippetID, false)))
                    return false;
            }

            return true;
        }
开发者ID:modulexcite,项目名称:snip2codeNET,代码行数:18,代码来源:SnippetsWS.cs

示例6: PublishSnippet

        public bool PublishSnippet(long snippetID, ICollection<int> channelIDs)
        {
            if ((snippetID <= 0) || channelIDs.IsNullOrEmpty())
            {
                SetLastError(log, ErrorCodes.WRONG_INPUT, string.Format("Input error: snippetID={0}; channelIDs={1}", snippetID, channelIDs.PrintNull()));
                return false;
            }

            //send the request and parse the response:
            string content = Utilities.MergeIntoCommaSeparatedString(channelIDs, true);
            string contentToSend = string.Format("snippetID={0}&channelsIDs={1}", snippetID, content);
            S2CResObj<object> resp = SendReqObj(PUBLISH_SNIPPET_URL, contentToSend, true);

            //build the result:
            return ParseBoolResponse(resp);
        }
开发者ID:modulexcite,项目名称:snip2codeNET,代码行数:16,代码来源:SnippetsWS.cs

示例7: AddSnippetProperties

        public bool AddSnippetProperties(long snippetID, ICollection<SnippetProperty> properties)
        {
            if ((snippetID <= 0) || properties.IsNullOrEmpty())
            {
                SetLastError(log, ErrorCodes.WRONG_INPUT, 
                    string.Format("Input error: snippetID={0}, properties={1}", snippetID, properties.Print<SnippetProperty>()));
                return false;
            }

            //check input properties and clean them if not valid:
            List<SnippetProperty> cleanProperties = SnippetProperty.CleanPropertyList(properties, snippetID);

            //fastly return if no properties are to be added:
            if (cleanProperties.IsNullOrEmpty())
                return true;

            //send the request and parse the response:
            S2CSerializer ser = new S2CSerializer(m_serialFormat, snippetID);
            string contentToSend = "content=" + HttpUtility.UrlEncode(ser.SerializeBaseEntityList<SnippetProperty>(cleanProperties.ToArray(), null));
            S2CResObj<object> resp = SendReqObj(ADD_PROPERTIES_URL, contentToSend, true);

            //build the result:
            return ParseBoolResponse(resp);
        }
开发者ID:modulexcite,项目名称:snip2codeNET,代码行数:24,代码来源:SnippetsWS.cs

示例8: FindChannelsItems

        public IList<Snippet> FindChannelsItems(int start, int count, ICollection<int> channelsIDs, out int totNum,
                ItemSortField field = ItemSortField.Relevance, SortDirection direction = SortDirection.Descent,
                bool findAllChannels = false)
        {
            //check for erroneous input:
            totNum = 0;
            if ((count <= 0) || (start < 0) || (channelsIDs.IsNullOrEmpty() && !findAllChannels))
            {
                SetLastError(log, ErrorCodes.WRONG_INPUT, string.Format("Input error: userID={0}, count={1}, start={2}, channelsIDs={3}",
                    CurrentUserID, count, start, channelsIDs.Print()));
                return new List<Snippet>();
            }

            //exec the SP:
            string search = string.Format("{0}={1}", DefaultProperty.Channel,
                (findAllChannels ? "*" : Utilities.MergeIntoCommaSeparatedString(channelsIDs, true)));
            Dictionary<string, string[]> misSpellings = null;
            int totNumWithNonDefOp = 0;
            SortedDictionary<string, int> tagsOccurrences = null; 
            return GetSnippetsForSearch(search, out misSpellings, out totNum, out totNumWithNonDefOp, out tagsOccurrences,
                        count, start, false, 0, field, direction);
        }
开发者ID:modulexcite,项目名称:snip2codeNET,代码行数:22,代码来源:SnippetsWS.cs

示例9: IsNullOrEmpty

 public void IsNullOrEmpty(ICollection col, bool expectedResult)
 {
     Assert.That(col.IsNullOrEmpty(), Is.EqualTo(expectedResult));
 }
开发者ID:akordowski,项目名称:NToolbox,代码行数:4,代码来源:CollectionExtensionTest.cs


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