PageRenderTime 39ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/Microsoft.Scripting.Core/Ast/MemberBinding.cs

https://bitbucket.org/stefanrusek/xronos
C# | 83 lines | 31 code | 8 blank | 44 comment | 0 complexity | dd5fd14074e0d00f69efe88470b2db74 MD5 | raw file
  1. /* ****************************************************************************
  2. *
  3. * Copyright (c) Microsoft Corporation.
  4. *
  5. * This source code is subject to terms and conditions of the Microsoft Public License. A
  6. * copy of the license can be found in the License.html file at the root of this distribution. If
  7. * you cannot locate the Microsoft Public License, please send an email to
  8. * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
  9. * by the terms of the Microsoft Public License.
  10. *
  11. * You must not remove this notice, or any other, from this software.
  12. *
  13. *
  14. * ***************************************************************************/
  15. using System; using Microsoft;
  16. using System.Reflection;
  17. #if CODEPLEX_40
  18. namespace System.Linq.Expressions {
  19. #else
  20. namespace Microsoft.Linq.Expressions {
  21. #endif
  22. /// <summary>
  23. /// Describes the binding types that are used in MemberInitExpression objects.
  24. /// </summary>
  25. public enum MemberBindingType {
  26. /// <summary>
  27. /// A binding that represents initializing a member with the value of an expression.
  28. /// </summary>
  29. Assignment,
  30. /// <summary>
  31. /// A binding that represents recursively initializing members of a member.
  32. /// </summary>
  33. MemberBinding,
  34. /// <summary>
  35. /// A binding that represents initializing a member of type <see cref="System.Collections.IList"/> or <see cref="System.Collections.Generic.ICollection{T}"/> from a list of elements.
  36. /// </summary>
  37. ListBinding
  38. }
  39. /// <summary>
  40. /// Provides the base class from which the classes that represent bindings that are used to initialize members of a newly created object derive.
  41. /// </summary>
  42. public abstract class MemberBinding {
  43. MemberBindingType _type;
  44. MemberInfo _member;
  45. /// <summary>
  46. /// Initializes an instance of <see cref="MemberBinding"/> class.
  47. /// </summary>
  48. /// <param name="type">The type of member binding.</param>
  49. /// <param name="member">The field or property to be initialized.</param>
  50. [Obsolete("Do not use this constructor. It will be removed in future releases.")]
  51. protected MemberBinding(MemberBindingType type, MemberInfo member) {
  52. _type = type;
  53. _member = member;
  54. }
  55. /// <summary>
  56. /// Gets the type of binding that is represented.
  57. /// </summary>
  58. public MemberBindingType BindingType {
  59. get { return _type; }
  60. }
  61. /// <summary>
  62. /// Gets the field or property to be initialized.
  63. /// </summary>
  64. public MemberInfo Member {
  65. get { return _member; }
  66. }
  67. /// <summary>
  68. /// Returns a <see cref="String"/> that represents the current <see cref="Object"/>.
  69. /// </summary>
  70. /// <returns>A <see cref="String"/> that represents the current <see cref="Object"/>. </returns>
  71. public override string ToString() {
  72. return ExpressionStringBuilder.MemberBindingToString(this);
  73. }
  74. }
  75. }