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

C# Sort类代码示例

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

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



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

示例1: Get

    /// <summary>
    /// Retrieves items from pocket
    /// with the given filters
    /// </summary>
    /// <param name="state">The state.</param>
    /// <param name="favorite">The favorite.</param>
    /// <param name="tag">The tag.</param>
    /// <param name="contentType">Type of the content.</param>
    /// <param name="sort">The sort.</param>
    /// <param name="search">The search.</param>
    /// <param name="domain">The domain.</param>
    /// <param name="since">The since.</param>
    /// <param name="count">The count.</param>
    /// <param name="offset">The offset.</param>
    /// <param name="cancellationToken">The cancellation token.</param>
    /// <returns></returns>
    /// <exception cref="PocketException"></exception>
    public async Task<IEnumerable<PocketItem>> Get(
      State? state = null,
      bool? favorite = null,
      string tag = null,
      ContentType? contentType = null,
      Sort? sort = null,
      string search = null,
      string domain = null,
      DateTime? since = null,
      int? count = null,
      int? offset = null,
      CancellationToken cancellationToken = default(CancellationToken)
    )
    {
      RetrieveParameters parameters = new RetrieveParameters()
      {
        State = state,
        Favorite = favorite,
        Tag = tag,
        ContentType = contentType,
        Sort = sort,
        DetailType = DetailType.complete,
        Search = search,
        Domain = domain,
        Since = since.HasValue ? ((DateTime)since).ToUniversalTime() : since,
        Count = count,
        Offset = offset
      };

      return (await Request<Retrieve>("get", cancellationToken, parameters.Convert())).Items ?? new List<PocketItem>();
    }
开发者ID:MSiccDev,项目名称:PocketSharp,代码行数:48,代码来源:Get.cs


示例2: Main

        private static void Main(string[] args)
        {
            Sort<string> sort = new Sort<string>();

            string[] array = new string[10]
            {
                "table",
                "coffee",
                "tea",
                "juice",
                "1",
                "apple",
                "sea",
                "tree",
                "leopard",
                "ant",
            };

            Console.WriteLine("Before sorting:");
            sort.Print(array);

            sort.SortArray(array, CompareStrings);

            Console.WriteLine("After sorting:");
            sort.Print(array);
        }
开发者ID:MasterOfDeath,项目名称:XT2015-5,代码行数:26,代码来源:Program.cs


示例3: Particle

		public Particle (int par1x, int par2y, Color par4color, Sort par5type)
		{
			life = 1F;
			int side = rand.Next (3, 5);
			if (par5type == Sort.Fog)
				side = rand.Next (5, 15);
			link = new Vector2 (par1x, par2y);
			if (par5type == Sort.Fixed) {
				int g = rand.Next (1, 3);
				if (g != 1)
					g = -1;
				int h = rand.Next (1, 3);
				if (h != 1)
					h = -1;
				par1x += rand.Next (0, 15) * g;
				par2y += rand.Next (0, 15) * h;
			}
			shape = new Rectangle (par1x, par2y, side, side);
			position = new Vector2 (shape.X, shape.Y);
			color = par4color;
			sprite = new Texture2D (Core.graphicsD, 1, 1);
			sprite.SetData (new Color[]{ color });
			if(par5type != Sort.Fog)
				light = EffectManager.addLight (new Light (shape.X + shape.Width / 2, shape.Y + shape.Height / 2, side / 10F, color));
			else
				life = 0.3F;
			type = par5type;
		}
开发者ID:chaipokoi,项目名称:Ocalm,代码行数:28,代码来源:Particle.cs


示例4: Search

        public List<User> Search(string request, Sort sort, out int count, int offset = 0,
            SearchProfileFields[] fields = null)
        {
            List<User> users = new List<User>();

            NameValueCollection qs = new NameValueCollection();
            qs["q"] = request;

            if (fields != null)
                qs["fields"] = String.Join(",", from field in fields select field.ToString());

            qs["sort"] = ((int)sort).ToString();
            qs["offset"] = offset.ToString();

            XmlDocument answer = VkResponse.ExecuteCommand("users.search", qs);

            XmlNode node = answer.SelectSingleNode("response/count");
            if (node != null)
                count = Convert.ToInt32(node.InnerText);
            else
            {
                count = 0;
            }

            XmlNodeList usersNodes = answer.SelectNodes("response/user");

            if (usersNodes != null)
                foreach (XmlNode user in usersNodes)
                {
                    users.Add(new User(user));
                }

            return users;
        }
开发者ID:natashalysakova,项目名称:VkApiLibarary,代码行数:34,代码来源:UserCategory.cs


示例5: GetGallery

 public static async Task<Response<List<Image>>> GetGallery(Section? section = null, Sort? sort = null, Window? window = null, bool? showViral = null, int? page = null)
 {
     string uri = "gallery";
     if (section != null)
     {
         uri += "/" + section.ToString().ToLower();
         if(sort != null)
         {
             uri += "/" + sort.ToString().ToLower();
             if(window != null)
             {
                 uri += "/" + window.ToString().ToLower();
                 if (showViral != null)
                 {
                     uri += "/" + showViral.ToString();
                     if (page != null)
                     {
                         uri += "/" + page;
                     }
                 }
             }
         }
     }
     return await NetworkHelper.GetRequest<List<Image>>(uri);
 }
开发者ID:akshay2000,项目名称:SharpImgur,代码行数:25,代码来源:Gallery.cs


示例6: GetAll

        /// <summary>Gets events.</summary>
        /// <param name="pagination">Pagination.</param>
        /// <param name="filter">Filters for events.</param>
        /// <param name="sort">Sort.</param>
        /// <returns>List of events matching passed filter criteria.</returns>
        public ListPaginated<EventDTO> GetAll(Pagination pagination, FilterEvents filter = null, Sort sort = null)
        {
            if (filter == null)
                return this.GetList<EventDTO>(MethodKey.EventsAll, pagination, "");

            return this.GetList<EventDTO>(MethodKey.EventsAll, pagination, "", sort, filter.GetValues());
        }
开发者ID:ioliver85,项目名称:mangopay2-net-sdk,代码行数:12,代码来源:ApiEvents.cs


示例7: WithNullParameters_ThrowsException

 public void WithNullParameters_ThrowsException()
 {
     Sort sort = new Sort();
     var ex = Assert.Throws<ArgumentNullException>(
         () => Generator.Object.Select(ClassMap.Object, null, null, null));
     StringAssert.Contains("cannot be null", ex.Message);
     Assert.AreEqual("Parameters", ex.ParamName);
 }
开发者ID:holer-h,项目名称:Dapper-Extensions,代码行数:8,代码来源:SqlGeneratorFixture.cs


示例8: List

        //
        // GET: /Advertisements/

        public ActionResult List(Sort sort = Sort.PublishDate, uint minPrice = 0, uint maxPrice = Int32.MaxValue)
        {
            log.Debug("Run List()");

            var advertisements = repository.Advertisements.Where(adv => minPrice <= adv.Price && adv.Price <= maxPrice).OrderBy(sort);
            var advertisementsListPagemodel = new AdvertisementsListPage(advertisements, sort, new AdvertisementsFilter(minPrice, maxPrice));
            return View(advertisementsListPagemodel);
        }
开发者ID:1KoT1,项目名称:BulletinBoard,代码行数:11,代码来源:AdvertisementsController.cs


示例9: GetItems

 public ActionResult GetItems(Sort v)
 {
     var options = new[]
                       {
                           new SelectableItem(Sort.None, "None", v == Sort.None),
                           new SelectableItem(Sort.Asc, "Asc", v== Sort.Asc),
                           new SelectableItem(Sort.Desc, "Desc", v== Sort.Desc)
                       };
     return Json(options);
 }
开发者ID:russellsamantha,项目名称:Git_Work,代码行数:10,代码来源:SortAjaxDropdownController.cs


示例10: PersonnageJouable

 public PersonnageJouable(int id, string nom, int lvl, int exp, EnumTypePersonnage tp, Equipement eq, CaracteristiquesPersonnage cp, ArbreCompetence ac)
 {
     _id = id;
     _nom = nom;
     _lvl = lvl;
     _exp = exp;
     _sort = new Sort[20];
     _typePersonnage = tp;
     _equipement = eq;
     _CPersonnage = cp;
     _ACompetence = ac;
 }
开发者ID:BabacarPlusPlus,项目名称:RPG,代码行数:12,代码来源:PersonnageJouable.cs


示例11: BubbleSortSlowest_Fail_EmptyArray

        public void BubbleSortSlowest_Fail_EmptyArray()
        {
            // ARRANGE
            Sort sortAlgos = new Sort();
            int[] testNums = { };

            // ACT
            sortAlgos.BubbleSlowest(testNums);

            // ASSERT
            // ExpectedException attribute
        }
开发者ID:aarcilla,项目名称:SearchAndSort,代码行数:12,代码来源:SortUnitTests.cs


示例12: Ennemi

 public Ennemi(int id, string nom, int lvl, int exp, EnumTypePersonnage tp, Equipement eq, CaracteristiquesPersonnage cp, EnumStatusEnnemi st, Ia ia)
 {
     _id = id;
     _nom = nom;
     _lvl = lvl;
     _exp = exp;
     _sort = new Sort[20];
     _typePersonnage = tp;
     _equipement = eq;
     _CPersonnage = cp;
     _status = st;
     _ia = ia;
 }
开发者ID:BabacarPlusPlus,项目名称:RPG,代码行数:13,代码来源:Ennemi.cs


示例13: GetTopicGallery

 public static async Task<Response<List<Image>>> GetTopicGallery(int topicId, Sort? sort = null, int? page = null)
 {
     //{topicId}/{sort}/{page}
     string uri = "topics/" + topicId;
     if (sort != null)
     {
         if (page != null)
         {
             uri += "/" + page;
         }
     }
     return await NetworkHelper.GetRequest<List<Image>>(uri);
 }
开发者ID:akshay2000,项目名称:SharpImgur,代码行数:13,代码来源:Topics.cs


示例14: OrderBy

 public static IEnumerable<Advertisement> OrderBy(this IEnumerable<Advertisement> advertisements, Sort sort)
 {
     switch (sort)
     {
         case Sort.Name:
             return advertisements.OrderBy(adv => adv.Name);
         case Sort.Price:
             return advertisements.OrderBy(adv => adv.Price);
         case Sort.PublishDate:
         default:
             return advertisements.OrderBy(adv => adv.PublishDate);
     }
 }
开发者ID:1KoT1,项目名称:BulletinBoard,代码行数:13,代码来源:AdvertisementsController.cs


示例15: BubbleSortSlower_Success_Descending

        public void BubbleSortSlower_Success_Descending()
        {
            // ARRANGE
            Sort sortAlgos = new Sort(SortOrder.Desc);

            // ACT
            int[] result = sortAlgos.BubbleSlower(testNumsUnordered);

            // ASSERT
            for (int i = 0; i < result.Length; i++)
            {
                Assert.AreEqual(testNumsOrderedDesc[i], result[i]);
            }
        }
开发者ID:aarcilla,项目名称:SearchAndSort,代码行数:14,代码来源:SortUnitTests.cs


示例16: BubbleSortSlowest_Success

        public void BubbleSortSlowest_Success()
        {
            // ARRANGE
            Sort sortAlgos = new Sort();

            // ACT
            int[] result = sortAlgos.BubbleSlowest(testNumsUnordered);

            // ASSERT
            for (int i = 0; i < result.Length; i++)
            {
                Assert.AreEqual(testNumsOrderedAsc[i], result[i]);
            }
        }
开发者ID:aarcilla,项目名称:SearchAndSort,代码行数:14,代码来源:SortUnitTests.cs


示例17: BubbleSort

 /*
     Simple Bubble sort using pointer to function for chosing to sort
     by SSN ascending
 */
 public static void BubbleSort(IPayable[] employees, Sort sort)
 {
     for(int i = employees.Length; i > 0; i--)
     {
         for (int j = 1; j < i; j++)
         {
             IPayable temp = employees[j - 1];
             //use pointer to function
             if((sort(employees[j], employees[j - 1]) < 1)){
                 //swap
                 employees[j - 1] = employees[j];
                 employees[j] = temp;
             }//end if
         }//end for
     }//end for
 }
开发者ID:lkondratczyk,项目名称:CECS-475-Labs,代码行数:20,代码来源:PayrollSystemTest.cs


示例18: GetSubreddditGallery

        public static async Task<Response<List<Image>>> GetSubreddditGallery(string subreddit, Sort? sort = null, Window? window = null, int? page = null)
        {
            //{ subreddit}/{ sort}/{ window}/{ page}
            string uri = "gallery/r/" + subreddit;
            if (sort != null)
            {
                uri += "/" + sort.ToString().ToLower();
                if (window != null)
                {
                    uri += "/" + window.ToString().ToLower();

                    if (page != null)
                    {
                        uri += "/" + page;
                    }
                }
            }
            return await NetworkHelper.GetRequest<List<Image>>(uri);
        }
开发者ID:akshay2000,项目名称:SharpImgur,代码行数:19,代码来源:Gallery.cs


示例19: Objects

        public void Objects()
        {
            string str;
            object nested = new Outer.Nested<int>();

            str = CSharpObjectFormatter.Instance.FormatObject(nested, s_inline);
            Assert.Equal(@"Outer.Nested<int> { A=1, B=2 }", str);

            str = CSharpObjectFormatter.Instance.FormatObject(nested, new ObjectFormattingOptions(memberFormat: MemberDisplayFormat.NoMembers));
            Assert.Equal(@"Outer.Nested<int>", str);

            str = CSharpObjectFormatter.Instance.FormatObject(A<int>.X, new ObjectFormattingOptions(memberFormat: MemberDisplayFormat.NoMembers));
            Assert.Equal(@"A<int>.B<int>", str);

            object obj = new A<int>.B<bool>.C.D<string, double>.E();
            str = CSharpObjectFormatter.Instance.FormatObject(obj, new ObjectFormattingOptions(memberFormat: MemberDisplayFormat.NoMembers));
            Assert.Equal(@"A<int>.B<bool>.C.D<string, double>.E", str);

            var sort = new Sort();
            str = CSharpObjectFormatter.Instance.FormatObject(sort, new ObjectFormattingOptions(maxLineLength: 51, memberFormat: MemberDisplayFormat.Inline));
            Assert.Equal(@"Sort { aB=-1, ab=1, Ac=-1, Ad=1, ad=-1, aE=1, a ...", str);
            Assert.Equal(51, str.Length);

            str = CSharpObjectFormatter.Instance.FormatObject(sort, new ObjectFormattingOptions(maxLineLength: 5, memberFormat: MemberDisplayFormat.Inline));
            Assert.Equal(@"S ...", str);
            Assert.Equal(5, str.Length);

            str = CSharpObjectFormatter.Instance.FormatObject(sort, new ObjectFormattingOptions(maxLineLength: 4, memberFormat: MemberDisplayFormat.Inline));
            Assert.Equal(@"...", str);

            str = CSharpObjectFormatter.Instance.FormatObject(sort, new ObjectFormattingOptions(maxLineLength: 3, memberFormat: MemberDisplayFormat.Inline));
            Assert.Equal(@"...", str);

            str = CSharpObjectFormatter.Instance.FormatObject(sort, new ObjectFormattingOptions(maxLineLength: 2, memberFormat: MemberDisplayFormat.Inline));
            Assert.Equal(@"...", str);

            str = CSharpObjectFormatter.Instance.FormatObject(sort, new ObjectFormattingOptions(maxLineLength: 1, memberFormat: MemberDisplayFormat.Inline));
            Assert.Equal(@"...", str);

            str = CSharpObjectFormatter.Instance.FormatObject(sort, new ObjectFormattingOptions(maxLineLength: 80, memberFormat: MemberDisplayFormat.Inline));
            Assert.Equal(@"Sort { aB=-1, ab=1, Ac=-1, Ad=1, ad=-1, aE=1, aF=-1, AG=1 }", str);
        }
开发者ID:hbarve1,项目名称:roslyn,代码行数:42,代码来源:ObjectFormatterTests.cs


示例20: Run

 public void Run()
 {
     using (Context ctx = new Context()) {
         Symbol s1 = ctx.MkSymbol(1);
         Symbol s2 = ctx.MkSymbol(1);
         Symbol s3 = ctx.MkSymbol(2);
         Sort[] domain = new Sort[0];
     Sort range = ctx.IntSort;
         TestDriver.CheckAssertion("a1", s1 == s2);
         TestDriver.CheckAssertion("a2", s1 != s3);
         TestDriver.CheckAssertion("a3", ctx.MkSymbol("x") != s1);
         TestDriver.CheckAssertion("a4", ctx.MkSymbol("x") == ctx.MkSymbol("x"));
         TestDriver.CheckAssertion("a5", ctx.MkFuncDecl("f", domain, range) == ctx.MkFuncDecl("f", domain, range));
         TestDriver.CheckAssertion("a6", ctx.MkFuncDecl("f", domain, range) != ctx.MkFuncDecl("g", domain, range));
         TestDriver.CheckAssertion("a7", ctx.MkUninterpretedSort("s") == ctx.MkUninterpretedSort("s"));
         TestDriver.CheckAssertion("a8", ctx.MkUninterpretedSort("s") != ctx.MkUninterpretedSort("t"));
         TestDriver.CheckAssertion("a9", ctx.MkUninterpretedSort("s") != ctx.IntSort);
         TestDriver.CheckAssertion("a10", ctx.MkConst("x", range) == ctx.MkConst("x", range));
         TestDriver.CheckAssertion("a11", ctx.MkConst("x", range) == ctx.MkConst(ctx.MkSymbol("x"), range));
         TestDriver.CheckAssertion("a12", ctx.MkConst("x", range) != ctx.MkConst("y", range));
     }
 }
开发者ID:ExiaHan,项目名称:z3test,代码行数:22,代码来源:compare.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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