GD0105.rst 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. GD0105: The exported property is an indexer
  2. ===========================================
  3. ==================================== ======================================
  4. Value
  5. ==================================== ======================================
  6. **Rule ID** GD0105
  7. **Category** Usage
  8. **Fix is breaking or non-breaking** Non-breaking
  9. **Enabled by default** Yes
  10. ==================================== ======================================
  11. Cause
  12. -----
  13. An indexer is annotated with the ``[Export]`` attribute. Indexers can't be exported.
  14. Rule description
  15. ----------------
  16. Godot doesn't allow exporting indexer properties.
  17. .. code-block:: csharp
  18. private int[] _backingField;
  19. // Indexers can't be exported.
  20. [Export]
  21. public int this[int index]
  22. {
  23. get => _backingField[index];
  24. set => _backingField[index] = value;
  25. }
  26. How to fix violations
  27. ---------------------
  28. To fix a violation of this rule, remove the ``[Export]`` attribute.
  29. When to suppress warnings
  30. -------------------------
  31. Do not suppress a warning from this rule. Indexers can't be exported so
  32. they will be ignored by Godot, resulting in runtime errors.