Forum Xamarin Xamarin.Forms

Can't edit static class variables

Let's say I have a file named Globals.cs that contains this class :

public static class Globals
        public static string foo { get; set; }

I can read foo value : string test =
But setting an other value to foo throws an error : = "something" \\Error says that it doesn't exist in this context

I checked the namespace, and it works in a simple Console Application. However, the error shows with a Xamarin Forms project.


  • AdamMeaneyAdamMeaney USMember ✭✭✭✭✭

    The only thing I can think is that maybe you are doing the set in a different project, one that doesn't have a reference to globals.

    I have set static variables in Xamarin before, it does work.

Sign In or Register to comment.