GetProperties() not returning the declared properties of a script, returning only inherited properties instead.

I am trying to get a list of the properties declared within the class but the best I seem to be able to do is to find the inherited members without any of the declared ones (This can be seen if using the below code but removing ‘BindingFlags.DeclaredOnly’). I would expect the below code to output the following:

Test123

scripts

_

Instead, what is returned is:

Test123

_

I’m hoping that someone will be able to set me right here.

Thanks!

using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;

public class Test123 : MonoBehaviour {

    public MonoBehaviour[] scripts;

    void Awake()
    {
        PropertyInfo[] properties = this.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);
        print(this.GetType().Name);
        for (int j = 0; j < properties.Length; j++)
            print(properties[j].Name);
        print("_");
    }

}

scripts is not a property but a field. A property (in the sense of C# / .NET) is a set of two methods: a getter and a setter. A field is an actual data field. If you want to get the field of a class use GetFields instead of GetProperties