本文整理汇总了C#中RouteCollection.Select方法的典型用法代码示例。如果您正苦于以下问题:C# RouteCollection.Select方法的具体用法?C# RouteCollection.Select怎么用?C# RouteCollection.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RouteCollection
的用法示例。
在下文中一共展示了RouteCollection.Select方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConvertRoutesToLowercase
static void ConvertRoutesToLowercase(RouteCollection routes)
{
var lowercaseRoutes = routes.Select(r => new LowercaseRoute(r)).ToArray();
routes.Clear();
foreach (var route in lowercaseRoutes)
{
routes.Add(route);
}
}
示例2: PrintRoutes
public static void PrintRoutes(RouteCollection routes)
{
var file = File.CreateText("c:\\code\\routes.txt");
file.WriteLine("method | path | controller#action | area");
foreach (var route in routes.Select(x => (Route)x))
{
file.WriteLine(
string.Join(" ", ((HttpMethodConstraint)route.Constraints["httpMethod"]).AllowedMethods.ToArray()) + " | " +
route.Url + " | " +
route.Defaults["controller"] + "#" + route.Defaults["action"] + " | " +
route.Constraints["area"]
);
}
file.Close();
}
示例3: RegisterRoutes
public override void RegisterRoutes(RouteCollection routeCollection)
{
if (_subMapper != null)
{
_subMapper.Invoke(this);
}
var routes = new RouteCollection();
BasePath = Join(BasePath, _pathPrefix);
AddResourcePath(_pathPrefix);
RegisterNested(routes, mapper => mapper.SetParentResources(ResourcePaths));
foreach (var route in routes.Select(x => (Route)x))
{
ConstrainArea(route);
AppendRouteTo(routeCollection, route);
}
}