GetsystemVariable and SetSystemVariable of the Application object can be used to access the OSMODE setting. Refer below .NET code
[CommandMethod("testOsnap")]
public static void testOsnap()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
Object obj = Application.GetSystemVariable("osmode");
ed.WriteMessage("Current OSNAP : " + obj.ToString() + "\n");
Application.SetSystemVariable("OSMODE", 2);
//get the new OSNAP value..
obj = Application.GetSystemVariable("osmode");
ed.WriteMessage("OSNAP : " + obj.ToString() + "\n");
}