Jump to content

No parameterless constructor defined


photo

Recommended Posts

Good evening,

To solve this issiue this part must be added:

    public class Example {
        public string name;
        public Example(){} // this part
    
        public Example(string name){
            this.name = name;
        }
    }

Why is this required?

public Example(){} 

 

Link to comment

Please refer to this article: https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/instance-constructors#parameterless-constructors

>If you declare at least one instance constructor in a class, C# doesn't provide a parameterless constructor.

  • Like 1

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
×
×
  • Create New...