I have a .Net C# class where I need to make a variable public. I need to initialize this variable within a method (not within the constructor). However, I don\'t want the
You have to use a property for this. If you are fine with an automatic getter/setter implementation, this will work:
public string SomeProperty { get; private set; }
Note that you should not expose fields as public anyway, except in some limited circumstances. Use a property instead.