Creating object on specific layer

Hi All
I’m new to Rhino development, so excuse me for any obvious questions…
I’m working with RhinoCommon c#.
I’m trying to create lines on a specific layer (not Default layer) from code. what should be done to assign a layer to object?

thanks…

   public static Rhino.Commands.Result AddLine(Rhino.RhinoDoc doc, Rhino.Geometry.Point3d start, Rhino.Geometry.Point3d end )
    {

        Rhino.Geometry.Vector3d v = end - start;
        if (v.IsTiny(Rhino.RhinoMath.ZeroTolerance))
            return Rhino.Commands.Result.Nothing;

        if (doc.Objects.AddLine(start, end) != Guid.Empty)
        {
            doc.Views.Redraw();
            return Rhino.Commands.Result.Success;
        }
        return Rhino.Commands.Result.Failure;
    }

You need to create ObjectAttributes, and use them when adding a line
http://4.rhino3d.com/5/rhinocommon/html/M_Rhino_DocObjects_Tables_ObjectTable_AddLine_3.htm

On the attributes, you can specify the layer index, which can be obtained from the layers table.

wonderful. thanks