本文整理汇总了C#中Sort类的典型用法代码示例。如果您正苦于以下问题:C# Sort类的具体用法?C# Sort怎么用?C# Sort使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Sort类属于命名空间,在下文中一共展示了Sort类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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>();
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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());
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例11: BubbleSortSlowest_Fail_EmptyArray
public void BubbleSortSlowest_Fail_EmptyArray()
{
// ARRANGE
Sort sortAlgos = new Sort();
int[] testNums = { };
// ACT
sortAlgos.BubbleSlowest(testNums);
// ASSERT
// ExpectedException attribute
}
示例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;
}
示例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);
}
示例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);
}
}
示例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]);
}
}