mardi 13 novembre 2018

Judge whether a property is created by a function via reflection

Suppose I have a class Foo like below:

class Foo
{
    public static int Bar()
    {
        return 1;
    }

    public static int x = Bar();
    public static int y = 2;
}

I want to use reflection to know that:

  1. x is initialized via the function Bar.
  2. y isn't initialized via the function Bar.

Is there any way to do this?





Aucun commentaire:

Enregistrer un commentaire