GetFields() public static method

public static GetFields ( this type ) : IEnumerable
type this
return IEnumerable
Ejemplo n.º 1
0
        static DependencyProperty GetForegroundProperty(FrameworkElement element)
        {
            if (element is Control)
            {
                return(Control.ForegroundProperty);
            }
            if (element is TextBlock)
            {
                return(TextBlock.ForegroundProperty);
            }

            Type type = element.GetType();

            DependencyProperty foregroundProperty;

            if (!ForegroundProperties.Value.TryGetValue(type, out foregroundProperty))
            {
                FieldInfo field = ReflectionExtensions.GetFields(type).FirstOrDefault(f => f.Name == "ForegroundProperty");
                if (field == null)
                {
                    throw new ArgumentException("type is not a Foregroundable type");
                }

                var property = (DependencyProperty)field.GetValue(null);
                ForegroundProperties.Value.TryAdd(type, property);

                return(property);
            }

            return(foregroundProperty);
        }
Ejemplo n.º 2
0
        public void ReflectionExtensionsGetFields()
        {
            tlog.Debug(tag, $"ReflectionExtensionsGetFields START");

            try
            {
                ReflectionExtensions.GetFields(new TypeImpl());
            }
            catch (Exception e)
            {
                tlog.Debug(tag, e.Message.ToString());
                Assert.Fail("Caught Exception : Failed!");
            }

            tlog.Debug(tag, $"ReflectionExtensionsGetFields END");
        }
        public static void UpdateStructure(Database Database)
        {
            Table[] tables = ReflectionExtensions.GetFields <Table>(typeof(DatabaseGenerator), ReflectionExtensions.PrivateStaticFlags);

            StringBuilder updateQuery     = new StringBuilder();
            StringBuilder deprecatedQuery = new StringBuilder();

            for (int i = 0; i < tables.Length; ++i)
            {
                TSQLGenerator.MySQL.GenerateCreateTable(Database, tables[i], SyncTypes.Keep, updateQuery, deprecatedQuery);
            }

            if (updateQuery.Length != 0)
            {
                Database.Execute(updateQuery.ToString());
            }
        }
Ejemplo n.º 4
0
        public void ReflectionExtensionsGetFields()
        {
            tlog.Debug(tag, $"ReflectionExtensionsGetFields START");

            try
            {
                TypeImplement type = new TypeImplement();

                ReflectionExtensions.GetFields(type);
            }
            catch (Exception e)
            {
                Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
                Assert.Fail("Caught Exception" + e.ToString());
            }

            tlog.Debug(tag, $"ReflectionExtensionsGetFields END (OK)");
            Assert.Pass("ReflectionExtensionsGetFields");
        }