C# interface with dynamo

I want to write a custom DLL file from c# and be used in dynamo. I wrote a simple c# script shown below:

#region Namespaces
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
#endregion


namespace HelloWorld
{
    public class HelloWorld
    {
        public void SayHello(string Whattosay, string title, bool show)
        {
            if (show)
            {
                TaskDialog.Show(title, Whattosay);
            }
               
        }
    }
}

But when I try to import the dll file everything works except it asked me to pass the helloworld class on the block.
Screenshot 2021-07-23 115236

Is there a way to code this so dynamo will not ask for the helloworld class?

Hi @RevitDummy,

As written, the SayHello method requires an instance of the HelloWorld class. I believe you’d need to make it a static member instead.

3 Likes

:rofl: of course. Thanks!