You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
3.4 KiB

  1. #region License
  2. // Copyright (c) 2007 James Newton-King
  3. //
  4. // Permission is hereby granted, free of charge, to any person
  5. // obtaining a copy of this software and associated documentation
  6. // files (the "Software"), to deal in the Software without
  7. // restriction, including without limitation the rights to use,
  8. // copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. // copies of the Software, and to permit persons to whom the
  10. // Software is furnished to do so, subject to the following
  11. // conditions:
  12. //
  13. // The above copyright notice and this permission notice shall be
  14. // included in all copies or substantial portions of the Software.
  15. //
  16. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  17. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  18. // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  19. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  20. // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  21. // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  22. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  23. // OTHER DEALINGS IN THE SOFTWARE.
  24. #endregion
  25. #if !NET20
  26. using System.Collections.Generic;
  27. using System.Dynamic;
  28. namespace Newtonsoft.Json.Utilities
  29. {
  30. internal class DynamicProxy<T>
  31. {
  32. public virtual IEnumerable<string> GetDynamicMemberNames(T instance)
  33. {
  34. return CollectionUtils.ArrayEmpty<string>();
  35. }
  36. public virtual bool TryBinaryOperation(T instance, BinaryOperationBinder binder, object arg, out object result)
  37. {
  38. result = null;
  39. return false;
  40. }
  41. public virtual bool TryConvert(T instance, ConvertBinder binder, out object result)
  42. {
  43. result = null;
  44. return false;
  45. }
  46. public virtual bool TryCreateInstance(T instance, CreateInstanceBinder binder, object[] args, out object result)
  47. {
  48. result = null;
  49. return false;
  50. }
  51. public virtual bool TryDeleteIndex(T instance, DeleteIndexBinder binder, object[] indexes)
  52. {
  53. return false;
  54. }
  55. public virtual bool TryDeleteMember(T instance, DeleteMemberBinder binder)
  56. {
  57. return false;
  58. }
  59. public virtual bool TryGetIndex(T instance, GetIndexBinder binder, object[] indexes, out object result)
  60. {
  61. result = null;
  62. return false;
  63. }
  64. public virtual bool TryGetMember(T instance, GetMemberBinder binder, out object result)
  65. {
  66. result = null;
  67. return false;
  68. }
  69. public virtual bool TryInvoke(T instance, InvokeBinder binder, object[] args, out object result)
  70. {
  71. result = null;
  72. return false;
  73. }
  74. public virtual bool TryInvokeMember(T instance, InvokeMemberBinder binder, object[] args, out object result)
  75. {
  76. result = null;
  77. return false;
  78. }
  79. public virtual bool TrySetIndex(T instance, SetIndexBinder binder, object[] indexes, object value)
  80. {
  81. return false;
  82. }
  83. public virtual bool TrySetMember(T instance, SetMemberBinder binder, object value)
  84. {
  85. return false;
  86. }
  87. public virtual bool TryUnaryOperation(T instance, UnaryOperationBinder binder, out object result)
  88. {
  89. result = null;
  90. return false;
  91. }
  92. }
  93. }
  94. #endif