Question try to code my 1st class library, lots of compilation errors

raymond0517

New member
Joined
Dec 23, 2020
Messages
4
Programming Experience
Beginner
Hi, C# forum,
just start C#, try out the 1st class library,
in it, simply try to UpdateWindow using the input whnd argument,
however, receive lots of compilation errors,
can someone please help ?
would be grateful can provide me link to have concise and clear illustration of how to create simple class library with input, output, and input/output arguments.

the coding is as follows :


C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Activities;
using System.ComponentModel.Composition;


namespace whandle_gui
{
    public class Update_Window:
    {
        [Category("Input")]
        public InArgument<IntPtr> whandle { get; set; }
        UpdateWindow(whandle);

    }
}

The compilation errors and list of resources are shown in the attached screenshot
Screenshot (111).png
 
Firstly, get rid of the colon after the name of the class. You only use a colon there if you are inheriting another class or implementing one or more interfaces.

Secondly, I'm not sure what you're actually trying to accomplish here:
C#:
UpdateWindow(whandle);
That is a call to a method but it can't be just floating in a class like that. It needs to be inside the body of a method or the getter or setter of a property. If you actually meant to declare a method rather than call one then I suggest that you work through a beginners' tutorial and learn how to declare methods because it's not like that.

It's not really for us to teach you how to create a class library because that just means a project that builds to a DLL. We can't tell you what code to write. It's up to you to learn how to write valid C# code that does what you want and then write it. If you have to do that in application projects first then do that. If you have specific issues then by all means ask about them but "how do I create a class library" is not a specific question.
 
Also, that Category attribute seems rather useless because that's basically an instruction to the WinForms or WPF designer regarding which section of the Properties window in which to display that property. Your class is not a component or a control so it won't be used in the designer, at least not as it is.
 
Hi , jmcilhinney,
I got the above coding from the video
in it, he introduced how to build a .dll and include it in UiPath as an activity.
He mentioned that the way to build a C# class so that it becomes an activity that can be called within UiPath.
I actually trying to use the input window handle, and try to redraw the window, hence, use the UpdateWindow method.

Hope to call this activity named Update_Window in UiPath
 
Back
Top Bottom