Getting error "CS0106: The modifier 'public' is not valid for this item." while using AutoCAD

I am using VS2019 configured to C# to integrate AutoCAD into it. Below is my code, 

using System.IO;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Runtime;

[CommandMethod("OpenDrawing", CommandFlags.Session)]

 public static void OpenDrawing()
{
    string strFileName = "C:\\DRAFT.dwg";
    DocumentCollection acDocMgr = Application.DocumentManager;

    if (File.Exists(strFileName))
        {
            acDocMgr.Open(strFileName, false);
        }
        else
        {
            acDocMgr.MdiActiveDocument.Editor.WriteMessage("File " + strFileName +
                                                            " does not exist.");
        }
    }

i am getting errors as mentioned below

"CS0106: The modifier 'public' is not valid for this item"
"CS8321: The local function 'OpenDrawing' is declared but never used"

I am not from computer science background so please consider and guide me in case i would have made any silly mistake.