PageRenderTime 133ms CodeModel.GetById 115ms RepoModel.GetById 0ms app.codeStats 0ms

/src/LinFu.IoC/Configuration/NamedType.cs

http://github.com/philiplaureano/LinFu
C# | 59 lines | 28 code | 7 blank | 24 comment | 0 complexity | d4fbf7cac6955eedabcbb88cb83859eb MD5 | raw file
  1. using System;
  2. using System.Reflection;
  3. using LinFu.IoC.Configuration.Interfaces;
  4. namespace LinFu.IoC.Configuration
  5. {
  6. /// <summary>
  7. /// Represents a named type.
  8. /// </summary>
  9. public class NamedType : INamedType
  10. {
  11. /// <summary>
  12. /// Initializes a new instance of the <see cref="NamedType" /> class.
  13. /// </summary>
  14. public NamedType()
  15. {
  16. }
  17. /// <summary>
  18. /// Initializes a new instance of the <see cref="NamedType" /> class.
  19. /// </summary>
  20. /// <param name="currentType">The current type.</param>
  21. public NamedType(Type currentType)
  22. {
  23. Type = currentType;
  24. }
  25. /// <summary>
  26. /// Initializes a new instance of the <see cref="NamedType" /> class.
  27. /// </summary>
  28. /// <param name="parameter">The target parameter.</param>
  29. public NamedType(ParameterInfo parameter)
  30. {
  31. Name = parameter.Name;
  32. Type = parameter.ParameterType;
  33. }
  34. /// <summary>
  35. /// Initializes a new instance of the <see cref="NamedType" /> class.
  36. /// </summary>
  37. /// <param name="property">The target property.</param>
  38. public NamedType(PropertyInfo property)
  39. {
  40. Name = property.Name;
  41. Type = property.PropertyType;
  42. }
  43. /// <summary>
  44. /// Gets or sets a value indicating the name that will be associated with the current type.
  45. /// </summary>
  46. public string Name { get; set; }
  47. /// <summary>
  48. /// Gets or sets the value indicating the current target type.
  49. /// </summary>
  50. public Type Type { get; set; }
  51. }
  52. }