Skip to content
Sign upLog in
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
2

Method group + field

Bunnytoes
Bunnytoes

When I try it to replace Style with style, it throws an error saying error CS0118: `MainClass.style' is a `field' but a `method group' was expected please help

1 year ago

Voters

Comments

TopNew
1
Coder100
Coder100

uh it works for me? confirm it actually saved

1 year ago
1
Bunnytoes
Bunnytoes

@Coder100
it works because I didn't replace the Style with style in lines 11-21 I'll show you

1 year ago
1
Coder100
Coder100

@Bunnytoes
well, as you may know, style is a class (method group), and not a function.

1 year ago
1
Bunnytoes
Bunnytoes

@Coder100
it says it was expecting a method group main.cs(11,5): error CS0118: `MainClass.style' is a `field' but a `method group' was expected

1 year ago
1
Coder100
Coder100

yeah that's literally a class???

@Bunnytoes

1 year ago
1
Bunnytoes
Bunnytoes

@Coder100
yes look at style.cs

1 year ago
1
Coder100
Coder100

exactly and you can't call a class did you mean styles.Style?

@Bunnytoes

1 year ago
1
Bunnytoes
Bunnytoes

@Coder100
I fixed it, thanks

1 year ago