For C# you don't need all those "as System.Web.Routing.RouteData". You declare your type with the "RouteData" at the beginning of the line. You may need to do some casting like this though:
RouteData RouteDatax = (RouteData)(HttpContext.Current.Items["RouteData"]);
That should make the line of code more valid. I'm not sure what you are meaning about converting the line into "an APP_Code" though...
Edit - Correcting other errors:
public static class RouteDatax
{
public static string RouteDataxx = (RouteData)(HttpContext.Current.Items["RouteData"]);
}
The above code should compile. Changes made include:
- making the declared property static - can't have a non-static member of a static class
- removing the return statement - it makes no sense in a class context
- changing the name of the field - you can't have a member named the same as its enclosing type
This assumes you are trying to create a class with that as a field. You could also have made it a property like so:
public RouteData myValue
{
get
{
RouteData RouteDatax = (RouteData)(HttpContext.Current.Items["RouteData"]);
return RouteDatax;
}
}
or a method:
public static class RouteDatax
{
public RouteData myValue()
{
RouteData RouteDatax = (RouteData)(HttpContext.Current.Items["RouteData"]);
return RouteDatax;
}
}
Hope that helps.