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


C# SortedSet.UnionWith方法代码示例

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


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

示例1: GetTypesForImport

        //recursively get all the types this object represents.
        private SortedSet<Type> GetTypesForImport(Object value)
        {
            Type valueType = value.GetType();
            SortedSet<Type> set = new SortedSet<Type>();
            IEnumerable collection = value as IEnumerable;
            if (collection != null)
            {
                foreach (var item in collection)
                {
                    set.UnionWith(GetTypesForImport(item));
                }
            }
            else if (valueType.IsGenericType)
            {
                Type generictype = valueType.GetGenericTypeDefinition();
                set.UnionWith(generictype.GetGenericArguments());
                //also add the valueType to be used as raw data
                set.Add(valueType);
            }
            else 
                set.Add(CLRObjectMarshler.GetPublicType(valueType));

            return set;
        }
开发者ID:algobasket,项目名称:Dynamo,代码行数:25,代码来源:ContextDataManager.cs

示例2: GetAllVideosBasedOnEntitlements

        public ActionResult GetAllVideosBasedOnEntitlements()
        {
            List<ShowLookUpObject> list = null;

            if (!GlobalConfig.IsSynapseEnabled)
                return Json(list, JsonRequestBehavior.AllowGet);
            var registDt = DateTime.Now;
            if (MyUtility.isUserLoggedIn())
            {
                try
                {
                    //var cache = DataCache.Cache;
                    //string cacheKey = "MOBILEGAV:U:" + User.Identity.Name;
                    //list = (List<ShowLookUpObject>)cache[cacheKey];
                    if (list == null)
                    {
                        list = new List<ShowLookUpObject>();
                        var context = new IPTV2Entities();
                        var UserId = new Guid(User.Identity.Name);
                        var user = context.Users.FirstOrDefault(u => u.UserId == UserId);
                        if (user != null)
                        {
                            SortedSet<Int32> ShowIds = new SortedSet<int>();
                            var service = context.Offerings.Find(GlobalConfig.offeringId).Services.FirstOrDefault(s => s.StatusId == GlobalConfig.Visible);
                            foreach (var entitlement in user.Entitlements.Where(e => e.EndDate > registDt))
                            {
                                if (entitlement is PackageEntitlement)
                                {
                                    var packageEntitlement = (PackageEntitlement)entitlement;
                                    var pkgCat = context.PackageCategories.Where(p => p.PackageId == packageEntitlement.PackageId).Select(p => p.Category);
                                    var pkgCatSubCategories = pkgCat.Select(p => p.SubCategories);
                                    foreach (var categories in pkgCatSubCategories)
                                    {
                                        foreach (var category in categories)
                                        {
                                            var listOfIds = service.GetAllMobileShowIds(MyUtility.GetCurrentCountryCodeOrDefault(), category);
                                            var showList = context.CategoryClasses.Where(c => listOfIds.Contains(c.CategoryId) && c.StatusId == GlobalConfig.Visible);
                                            foreach (var show in showList)
                                            {
                                                if (show != null)
                                                {
                                                    if (!(ShowIds.Contains(show.CategoryId)))
                                                    {
                                                        if (show.StartDate < registDt && show.EndDate > registDt)
                                                        {
                                                            if (show is Show)
                                                            {
                                                                if (!(show is LiveEvent))
                                                                {
                                                                    ShowLookUpObject data = new ShowLookUpObject();
                                                                    data.Show = show.Description;
                                                                    data.ShowId = show.CategoryId;
                                                                    data.MainCategory = category.Description;
                                                                    data.MainCategoryId = category.CategoryId;
                                                                    data.ShowType = (show is Movie) ? "MOVIE" : "SHOW";
                                                                    if (!(show is Movie))
                                                                        list.Add(data);
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            ShowIds.UnionWith(listOfIds); //For checking
                                        }
                                    }
                                }
                                else if (entitlement is ShowEntitlement)
                                {
                                    var showEntitlement = (ShowEntitlement)entitlement;
                                    if (!(ShowIds.Contains(showEntitlement.CategoryId)))
                                    {
                                        if (!(showEntitlement.Show is LiveEvent))
                                        {
                                            ShowLookUpObject data = new ShowLookUpObject();
                                            var show = showEntitlement.Show;
                                            if (show != null)
                                            {
                                                if (show.StartDate < registDt && show.EndDate > registDt)
                                                {
                                                    var CacheDuration = new TimeSpan(0, GlobalConfig.GetParentCategoriesCacheDuration, 0);
                                                    var parentCategories = show.GetAllParentCategories(CacheDuration);
                                                    var parent = context.CategoryClasses.Where(c => parentCategories.Contains(c.CategoryId) && c.StatusId == GlobalConfig.Visible && c is Category);
                                                    data.Show = show.Description;
                                                    data.ShowId = show.CategoryId;
                                                    data.MainCategory = parent.First().Description;
                                                    data.MainCategoryId = parent.First().CategoryId;
                                                    data.ShowType = (show is Movie) ? "MOVIE" : "SHOW";
                                                    if (!(show is Movie))
                                                        ShowIds.Add(show.CategoryId);
                                                    list.Add(data);
                                                }
                                            }
                                        }
                                    }
                                }
                                else if (entitlement is EpisodeEntitlement)
                                {
                                    var episodeEntitlement = (EpisodeEntitlement)entitlement;
                                    var eCacheDuration = new TimeSpan(0, GlobalConfig.GetParentShowsForEpisodeCacheDuration, 0);
//.........这里部分代码省略.........
开发者ID:agentvnod,项目名称:tfctvoldcode,代码行数:101,代码来源:SynapseController.cs

示例3: UnionWith

		public void UnionWith ()
		{
			var set = new SortedSet<int> { 1, 3, 5, 7, 9 };
			set.UnionWith (new [] { 5, 7, 3, 7, 11, 7, 5, 2 });
			Assert.IsTrue (set.SequenceEqual (new [] { 1, 2, 3, 5, 7, 9, 11 }));
		}
开发者ID:mesheets,项目名称:Theraot-CF,代码行数:6,代码来源:SortedSetTest.cs

示例4: UnionWith_Null

		public void UnionWith_Null ()
		{
			var set = new SortedSet<int> ();
			set.UnionWith (null);
		}
开发者ID:mesheets,项目名称:Theraot-CF,代码行数:5,代码来源:SortedSetTest.cs

示例5: CheckOutcomeCore


//.........这里部分代码省略.........
                    result = Outcome.Valid;
                  }
                  break;
                }

                // TODO(wuestholz): Try out different ways for splitting up the work (e.g., randomly).
                var cnt = Math.Max(1, rem / frac);
                // It seems like assertions later in the control flow have smaller indexes.
                var split = new SortedSet<int>(unverified.Where((val, idx) => (rem - idx - 1) < cnt));
                Contract.Assert(0 < split.Count);
                var splitRes = CheckSplit(split, ref popLater, timeLimitPerAssertion, timeLimitPerAssertion, ref queries);
                if (splitRes == Outcome.Valid)
                {
                  unverified.ExceptWith(split);
                  frac = 1;
                }
                else if (splitRes == Outcome.Invalid)
                {
                  result = splitRes;
                  break;
                }
                else if (splitRes == Outcome.TimeOut)
                {
                  if (2 <= frac && (4 <= (rem / frac)))
                  {
                    frac *= 4;
                  }
                  else if (2 <= (rem / frac))
                  {
                    frac *= 2;
                  }
                  else
                  {
                    timedOut.UnionWith(split);
                    unverified.ExceptWith(split);
                    frac = 1;
                  }
                }
                else
                {
                  break;
                }
              }

              unverified.UnionWith(timedOut);

              var end = DateTime.UtcNow;

              SendThisVC("; end timeout diagnostics");

              if (CommandLineOptions.Clo.TraceDiagnosticsOnTimeout)
              {
                Console.Out.WriteLine("Terminated timeout diagnostics after {0:F0} ms and {1} prover queries.", end.Subtract(start).TotalMilliseconds, queries);
                Console.Out.WriteLine("Outcome: {0}", result);
                Console.Out.WriteLine("Unverified assertions: {0} (of {1})", unverified.Count, ctx.TimeoutDiagnosticIDToAssertion.Keys.Count);

                string filename = "unknown";
                var assertion = ctx.TimeoutDiagnosticIDToAssertion.Values.Select(t => t.Item1).FirstOrDefault(a => a.tok != null && a.tok != Token.NoToken && a.tok.filename != null);
                if (assertion != null)
                {
                  filename = assertion.tok.filename;
                }
                File.AppendAllText("timeouts.csv", string.Format(";{0};{1};{2:F0};{3};{4};{5};{6}\n", filename, options.TimeLimit, end.Subtract(start).TotalMilliseconds, queries, result, unverified.Count, ctx.TimeoutDiagnosticIDToAssertion.Keys.Count));
              }

              #endregion
开发者ID:qunyanm,项目名称:boogie,代码行数:67,代码来源:ProverInterface.cs

示例6: Details


//.........这里部分代码省略.........
                try
                {
                    var countryCode = MyUtility.GetCurrentCountryCodeOrDefault();
                    var context = new IPTV2Entities();
                    var country = context.Countries.FirstOrDefault(c => String.Compare(c.Code, countryCode, true) == 0);
                    var offering = context.Offerings.Find(GlobalConfig.offeringId);
                    var service = offering.Services.FirstOrDefault(o => o.PackageId == GlobalConfig.serviceId);
                    var listOfPackagesInProductGroup = MyUtility.StringToIntList(GlobalConfig.PackagesInProductGroup);

                    if (!String.IsNullOrEmpty(id))
                    {
                        int pid = 0;
                        try
                        {
                            pid = Int32.Parse(id);
                        }
                        catch (Exception) { }
                        ViewBag.id = pid;
                        using (profiler.Step("Get Subscription (w/ parameter)"))
                        {
                            var show = (Show)context.CategoryClasses.Find(pid);

                            /******* CHECK IF SHOW IS VIEWABLE VIA USER'S COUNTRY CODE & COUNTRY CODE BASED ON IP ADDRESS *****/
                            if (!ContextHelper.IsCategoryViewableInUserCountry(show, countryCode))
                                return RedirectToAction("Index", "Home");
                            string CountryCodeBasedOnIpAddress = MyUtility.GetCountryCodeViaIpAddressWithoutProxy();
                            if (!ContextHelper.IsCategoryViewableInUserCountry(show, CountryCodeBasedOnIpAddress))
                                return RedirectToAction("Index", "Home");

                            ViewBag.ShowName = show.Description;
                            SortedSet<Int32> productIds = new SortedSet<int>();
                            var packageProductIds = show.GetPackageProductIds(offering, countryCode, RightsType.Online);
                            if (packageProductIds != null)
                                productIds.UnionWith(packageProductIds);
                            var showProductIds = show.GetShowProductIds(offering, countryCode, RightsType.Online);
                            if (showProductIds != null)
                                productIds.UnionWith(showProductIds);
                            ViewBag.PackageProductIds = packageProductIds;
                            ViewBag.ShowProductIds = showProductIds;
                            var products = context.Products.Where(p => productIds.Contains(p.ProductId));
                            List<PackageContentSummary> contentSummary = new List<PackageContentSummary>();
                            if (products != null)
                            {
                                productList = new List<SubscriptionProductA>();
                                foreach (var product in products)
                                {
                                    if (product.IsForSale && product.StatusId == GlobalConfig.Visible)
                                    {
                                        if (product is SubscriptionProduct)
                                        {
                                            if (product is PackageSubscriptionProduct)
                                            {
                                                var pkgSubscriptionProduct = (PackageSubscriptionProduct)product;
                                                var package = pkgSubscriptionProduct.Packages.FirstOrDefault();
                                                var counter = 0;
                                                var item = new SubscriptionProductA() { product = (SubscriptionProduct)product, productGroup = pkgSubscriptionProduct.ProductGroup, isPackage = true };

                                                //SET DEFAULT PRODUCT ID VIA PARAM                                            
                                                if (PackageOption != null)
                                                {
                                                    if (listOfPackagesInProductGroup.Contains((int)PackageOption))
                                                        if (pkgSubscriptionProduct.ProductGroupId == PackageOption)
                                                            if (ProductOption != null)
                                                                item.productGroup.DefaultProductId = ProductOption;
                                                }
开发者ID:agentvnod,项目名称:tfctvoldcode,代码行数:66,代码来源:SubscribeController.cs


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