CS0122, just with a partial class...
Hey there, my plan is to call a variable from another class(all necessary methods and classes are public), just that the class I want to call from is is a partial one, do I have to necessarily call from a normal kind of class(non-partial)?
11 Replies
A partial class is no different than a normal class
It's just that its body can be split
I see, so what could be the problem then, shoul I send in the code?
There's some common use cases for partial classes, one is generated code; one part is autogenerated, and then you have the option of adding functionality to the class via another partial class file. This way you can safely regenerate the partial class without impacting your changes
I had to look up what CS0122 is
It's "member inaccessible due to protection levels"
And yeah, code would be useful
a guess is...
public partial class A
{
}
partial class A
{
}
not really, more like:
public partial class A
{
int a = x
}
public class B
{
Console.Writeline(A.a)
}
Well, if that is the case, then
a
is not public
So
Also, $paste the code here, and tell us which line the error occurs inIf your code is too long, you can post to https://paste.mod.gg/ and copy the link into chat for others to see your shared code!
yes yes ouu, I see it is private(its tagetport)
it worked! 😅 Thank you both a lot, now I get it... ps: you got a dope profile picture anugis... (Love that anime)
Can't wait for the second season lol