Class Cs.ImplicitElementAccess

java.lang.Object
org.openrewrite.csharp.tree.Cs.ImplicitElementAccess
All Implemented Interfaces:
Cs, org.openrewrite.java.tree.Expression, org.openrewrite.java.tree.J, org.openrewrite.Tree
Enclosing interface:
Cs

public static final class Cs.ImplicitElementAccess extends Object implements Cs, org.openrewrite.java.tree.Expression
Represents implicit element access in C# which allows accessing elements without specifying the element accessor target. This is commonly used in object initializers, collection initializers and anonymous object initializers.

For example:

 // Collection initializer
 new List {
     { 10, 20 }, // ImplicitElementAccess with two arguments
     { 30, 40 }
 }

 // Object initializer
 new Dictionary<string, string> {
     { "key1", "value1" }, // ImplicitElementAccess wrapping key-value pair arguments
     { "key2", "value2" }
 }
 
The argumentList field contains the list of arguments wrapped in braces, with whitespace preserved before the opening brace and between arguments.
  • Constructor Details

    • ImplicitElementAccess

      public ImplicitElementAccess()
  • Method Details

    • getArgumentList

      public List<Cs.Argument> getArgumentList()
    • withArgumentList

      public Cs.ImplicitElementAccess withArgumentList(List<Cs.Argument> argumentList)
    • acceptCSharp

      public <P> org.openrewrite.java.tree.J acceptCSharp(CSharpVisitor<P> v, P p)
      Specified by:
      acceptCSharp in interface Cs
    • getType

      public @Nullable org.openrewrite.java.tree.JavaType getType()
      Specified by:
      getType in interface org.openrewrite.java.tree.Expression
    • withType

      public Cs.ImplicitElementAccess withType(@Nullable org.openrewrite.java.tree.JavaType type)
      Specified by:
      withType in interface org.openrewrite.java.tree.Expression
    • getCoordinates

      public org.openrewrite.java.tree.CoordinateBuilder.Expression getCoordinates()
      Specified by:
      getCoordinates in interface org.openrewrite.java.tree.Expression
    • getPadding

      public Cs.ImplicitElementAccess.Padding getPadding()