ArcGISCompare.GeoDbProcs.BuildNONSDS C# (CSharp) Method

BuildNONSDS() static private method

static private BuildNONSDS ( IWorkspace theWS, String NONName ) : IClass
theWS IWorkspace
NONName String
return IClass
    internal static IClass BuildNONSDS(IWorkspace theWS, String NONName)
    {
      ITable t;
      IFields wFlds;
      IFieldsEdit wFldsEdit;
      IFieldEdit wFldEdit;
      UID theUID;
      Boolean buildTable = true;

      IFeatureWorkspace theFWS = (IFeatureWorkspace)theWS;
      try { t = theFWS.OpenTable(NONName); }
      catch { t = null; }
      finally { }

      if (t != null)
      {
        DialogResult theAns = MessageBox.Show("The table " + NONName + " Already Exists! Delete?", "Table Already Exists!", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
        buildTable = false;
        if (theAns == DialogResult.Yes)
        {
          try
          {
            IDataset theClass = (IDataset)t;
            if (theClass.CanDelete())
            {
              theClass.Delete();
              buildTable = true;
            }
          }
          catch (Exception ex) { }
        }
      }

      if (buildTable)
      {
        wFlds = new FieldsClass();
        wFldsEdit = (IFieldsEdit)wFlds;

        wFldsEdit.FieldCount_2 = 1;

        IField wFld = new FieldClass();
        wFldEdit = (IFieldEdit)wFld;

        wFldEdit.Name_2 = "OBJECTID";
        wFldEdit.AliasName_2 = "Object Identifier";
        wFldEdit.Type_2 = esriFieldType.esriFieldTypeOID;
        wFldsEdit.set_Field(0, wFld);

        theUID = new UIDClass();
        theUID.Value = "esriGeoDatabase.Object";

        t = theFWS.CreateTable(NONName, wFlds, theUID, null, "");

        return (IClass)t;
      }
      else return null;
    }