IProperty.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. namespace ShwasherSys.ReflectionMagic
  3. {
  4. /// <summary>
  5. /// Defines an mechanism to access members (e.g. fields or properties) of objects in a consistent way.
  6. /// </summary>
  7. public interface IProperty
  8. {
  9. /// <summary>
  10. /// Gets the name of the property.
  11. /// </summary>
  12. string Name { get; }
  13. /// <summary>
  14. /// Gets the type of the property.
  15. /// </summary>
  16. Type PropertyType { get; }
  17. /// <summary>
  18. /// Returns the property value of a specified object with optional index values for indexed properties.
  19. /// </summary>
  20. /// <param name="obj">The object whose property value will be returned. </param>
  21. /// <param name="index">Optional index values for indexed properties. The indexes of indexed properties are zero-based. This value should be null for non-indexed properties. </param>
  22. /// <returns>The member value of the specified object.</returns>
  23. object GetValue(object obj, object[] index);
  24. /// <summary>
  25. /// Sets the property value of a specified object with optional index values for index properties.
  26. /// </summary>
  27. /// <param name="obj">The object whose property value will be set. </param>
  28. /// <param name="value">The new property value. </param>
  29. /// <param name="index">Optional index values for indexed properties. This value should be null for non-indexed properties. </param>
  30. void SetValue(object obj, object value, object[] index);
  31. }
  32. }