On VS C# Express, I get this error when running the code below:
‘myComponent.SettingsComponentAttributes’ does not contain a
constructor that takes 1 arguments.
I have tried adding a constructor in the class itself but the same message applied to the new constructor:
public override void CreateAttributes()
{
m_attributes = new SettingsComponentAttributes(this);
}
public SettingsComponentAttributes(SettingsComponentAttributes obj)
{
}
Your class doesn’t declare any constructors, therefore it’s equivalent to having a single parameterless constructor:
You’re trying to pass an argument (
this) into the constructor – which isn’t going to work. You’ll need to either change your constructor call, or declare an appropriate constructor.You should also look at the error message carefully and work out why you needed to ask on Stack Overflow. Which bit of the message wasn’t clear to you? Revise that aspect of your C# knowledge. Understanding error messages is a very important part of being a good developer, and this one is fairly clear: