Search code examples
javac#charsequence

What's the C# equivalent of Java CharSequence type?


I'm working on converting a Java project to C#, but don't know what CharSequence is corresponding to C# type.


Solution

  • There is no direct equivalent in c#. Use string instead.

    The Java CharSequence is a simple abstraction, that allows methods with simple needs to accept a String, CharBuffer, Segment, StringBuffer, or StringBuilder without having to convert the others to String first.

    It allows minor performance improvement in Java for some API methods.