Accessing private member of a parameter within a Static method?
.net, .net-2.0, c#
Solution
Because it is in the class, it has access to private variables in it. Just like your instance public methods. It works the opposite way too. You can access private static members from instance members to create a Monostate pattern.
Problem
How can this code compile? The code below in the operator int CAN access a private variable of the class MyValue? Why? ``` class Program { static void Main(string[] args) { Myvalue my = new Myvalue(100); Console.WriteLine(my + 100); Console.Read(); } } public class Myvalue { private int _myvalue; public Myvalue(int value) { _myvalue = value; } public static implicit operator int(Myvalue v) { return v._myvalue; } } ```