ReflectionContext.cs 698 B

123456789101112131415161718192021222324
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // See the LICENSE file in the project root for more information.
  4. namespace System.Reflection
  5. {
  6. public abstract class ReflectionContext
  7. {
  8. protected ReflectionContext() { }
  9. public abstract Assembly MapAssembly(Assembly assembly);
  10. public abstract TypeInfo MapType(TypeInfo type);
  11. public virtual TypeInfo GetTypeForObject(object value)
  12. {
  13. if (value == null)
  14. throw new ArgumentNullException(nameof(value));
  15. return MapType(value.GetType().GetTypeInfo());
  16. }
  17. }
  18. }