Can't edit static class variables

Poto_feuPoto_feu Member ✭✭

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 = Globals.foo
But setting an other value to foo throws an error : Globals.foo = "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.

Answers

  • 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.