About
Pricing
Community
Teams
Start Free Trial
Log in
rwheeler23
asked on
11/16/2017
How to assign value to class member C#
I have defined this member in my Model class as such:
public static bool StackTraceWanted { get; private set; }
I know what to assign it the value of true or false in another portion of the code
Model.StackTraceWanted = true;
This does not work. How to I assign it a value?
C#
6
2
Last Comment
rwheeler23
8/22/2022 - Mon
p_davis
11/16/2017
you can only assign a value in the Model class itself and would just reference it as StackTraceWanted not Model.StackTraceWanted.
if you want to be able to assign out side of the model class then take away the private key word in the setter.
ASKER CERTIFIED SOLUTION
AndyAinscow
11/16/2017
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
p_davis
11/16/2017
shoot, didn't see the static
SOLUTION
kaufmed
11/16/2017
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
AndyAinscow
11/16/2017
Yes, but as the current code didn't work it implies it is outside the class
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
rwheeler23
11/16/2017
ASKER
Thanks
if you want to be able to assign out side of the model class then take away the private key word in the setter.