System.Reflection.Assembly.GetTypesSafe()

Here are the examples of the csharp api System.Reflection.Assembly.GetTypesSafe() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

19 Source : Ject.cs
with Apache License 2.0
from nesfit

public static Type FindType(string s)
        {
            if (_types.ContainsKey(s))
                return _types[s];

            var type = Type.GetType(s);

            if (type == null) // need to look elsewhere
            {
                // someones notational laziness causes me to look
                // everywhere... sorry... I know it's slow...
                // that's why I am caching things...
                var q = (from p in AppDomain.CurrentDomain.Getreplacedemblies()
                         from t in p.GetTypesSafe()
                         where t.FullName == s || t.Name == s
                         select t).ToArray();

                if (q.Length == 1)
                    type = q[0];
            }

            if (type != null)
            {
                // cache
                _types[s] = type;
                return type;
            }
            else
                throw new TypeLoadException(string.Format("Cannot find type {0}", s));

        }

19 Source : Ject.cs
with Apache License 2.0
from nesfit

internal static Type[] FindAllreplacedignableFrom(Type type)
        {
            if (!_descendants.ContainsKey(type))
            {
                // find all descendants of given type
                _descendants[type] = (from p in AppDomain.CurrentDomain.Getreplacedemblies()
                                      from t in p.GetTypesSafe()
                                      where type.IsreplacedignableFrom(t)
                                      select t).ToArray();
            }

            return _descendants[type];
        }