14.7 OracleString Structure

The OracleString structure represents a variable-length stream of characters to be stored in or retrieved from a database.

Class Inheritance

System.Object

  System.ValueType

    Oracle.DataAccess.Types.OracleString

Declaration

// C#
public struct OracleString : IComparable, INullable, IXmlSerializable

Requirements

Provider ODP.NET, Unmanaged Driver ODP.NET, Managed Driver

Assembly

Oracle.DataAccess.dll

Oracle.ManagedDataAccess.dll

Namespace

Oracle.DataAccess.Types

Oracle.ManagedDataAccess.Types

.NET Framework

3.5, 4.5, 4.6

4.5, 4.6

Thread Safety

All public static methods are thread-safe, although instance methods do not guarantee thread safety.

Example

// C#
 
using System;
using Oracle.DataAccess.Types;
 
class OracleStringSample
{
  static void Main()
  {
    // Initialize OracleString structs
    OracleString string1 = new OracleString("AAA");
    
    // Display the string "AAA"
    Console.WriteLine("{0} has length of {1}", string1, string1.Length);
 
    // Contatenate characters to string1 until the length is 5 
    while (string1.Length < 5)
      string1 = OracleString.Concat(string1,"a");
      
    // Display the string of "AAAaa"
    Console.WriteLine("{0} has length of {1}", string1, string1.Length);
  }
}