Get all categories of a parameter

Hello Nick,
thank you for your help with this code! Do you know if it is possible to change the binding categories of the parameters?

From where i get Element.Category custom node

Element.Category+ custom node from Clockwork doesn’t work on shared parameter element

Good day
Nick_Boytz python code helped me solve my issue, and I don’t see a code solution to the OP, so I share a solution in C#
Thanks…

[Transaction(TransactionMode.Manual)]
    [Regeneration(RegenerationOption.Manual)]
    class Cmd_ReturnParameterCategories : IExternalCommand
    {
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            Application app = commandData.Application.Application;
            Document doc = commandData.Application.ActiveUIDocument.Document;

            BindingMap bindingMap = doc.ParameterBindings;
            DefinitionBindingMapIterator iter = bindingMap.ForwardIterator();
            iter.Reset();
            Definition definition = null;


            while (iter.MoveNext())
            {
                definition = iter.Key;

                if (definition.Name == "CategoryName")
                {

                    InstanceBinding binding = (InstanceBinding)bindingMap.get_Item(definition);
                    foreach (Category c in binding.Categories)
                    {
                        TaskDialog.Show("t", $"{c.Name}");
                    }

                    break;
                }
            }


            return Result.Succeeded;
        }
    }