在排序传统的ASP集合 [英] Sorting a collection in classic ASP

查看:144
本文介绍了在排序传统的ASP集合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个相当简单的问题 - 我怎么排序的集合

It's quite a simple question - how do I sort a collection?

我有一个CSV与行按随机顺序文件。我想按照一列日期的行进行排序。难道我行添加到记录?我可以用一个排序的Scripting.Dictionary?

I've got a CSV file with rows in a random order. I'd like to sort the rows according to the date in one column. Do I add the rows to a recordset? Can I sort with a Scripting.Dictionary?

我已经清楚地被宠坏使用.NET和LINQ,现在我发现自己回到了传统的ASP的土地上,实现我一定是7年前知道这一点,并极大地失踪泛型。我觉得自己是一个完整的n00b。

I've clearly been spoilt with .NET and Linq, and now I find myself back in the land of classic asp, realising I must have known this 7 years ago, and missing generics immensely. I feel like a complete n00b.

推荐答案

在这种情况下,我会得到大哥.NET帮助。这是可能的使用 System.Collections.Sortedlist 在您的ASP应用程序,让你的键值对排序。

In this case I would get help from big brother .net. It's possible to use System.Collections.Sortedlist within your ASP app and get your key value pairs sorted.

set list = server.createObject("System.Collections.Sortedlist")
with list
  .add "something", "YY"
  .add "something else", "XX"
end with

for i = 0 to list.count - 1
    response.write(list.getKey(i) & " = " & list.getByIndex(i))
next

顺便说一句,如果以下.NET类可太:

Btw if the following .net classes are available too:


  • System.Collections.Queue

  • System.Collections.Stack

  • System.Collections.ArrayList

  • System.Collections.SortedList

  • System.Collections.Hashtable

  • System.IO.StringWriter

  • System.IO.MemoryStream;

另请参阅: COM .NET的奇迹互操作

这篇关于在排序传统的ASP集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆