Question: I am attempting to learn ArcObjects using a tutorial that uses VB.NET and I am trying to convert it to C#. I have Visual C# 2008 Express Edition. This is an ArcMap Add-In project that creates a button that displays a message box with the name of the top most layer in the data frame. Here is the VB.NET code:

```vb
Dim pMxDoc As IMxDocument
pMxDoc = My.ArcMap.Application.Document
Dim pMap As IMap
pMap = pMxDoc.FocusMap 
Dim pFLayer As IFeatureLayer2
pFLayer = pMap.Layer(0)

Dim strDisplayField As String
strDisplayField = pFLayer.DisplayField

MsgBox(strDisplayField, vbOKOnly, "Test")

```

My conversion in C# so far:

```c#
using ESRI.ArcGIS.ArcMapUI:
using ESRI.ArcGIS.Carto;

IMxDocument pMxDoc = ArcMap.Application.Document as IMxDocument;
IMap pMap = pMxDoc.FocusMap;
IFeatureLayer2 pFLayer = pMap.

```

There is no 'Layer' property. Only 'LayerCount' to choose from.
I even tried this:

```c#
IFeatureLayer2 pFLayer = ArcMap.Application.Document as IFeatureLayer2;
pFLayer = pMap.

```

this didn't work either.
I have looked all over the ArcMap Object Diagram and I can't find the FeatureLayer2 class anywhere. According to ArcObjects SDK for .NET there is a Layer member for the IMap interface, but I don't have access to that. Any help would be grealty appreciated.

Answer: 
One solution would be to create your own custom geoprocess that wraps the RouteTask. You pass all the parameters for the RouteTask and your extra parameters and then return the result of the RouteTask along with your own parameters. I used this method to take geocoding parameters and my own custom parameters, then called the geoprocess function and returned geocoding results along with my own tracking parameters that I had passed in.
I think I'm going to create a new class that will contain its own RouteTask, the callback function for the RouteTask and my own parameters. Then each time I need to use a routeTask, I will use my new object created.
What do you think?