Skip Headers

Oracle Data Provider for .NET Developer's Guide
Release 9.2.0.2

Part Number A96160-01
Go To Table Of Contents
Contents
Go To Index
Index

Go to previous page Go to beginning of chapter Go to next page

Oracle.DataAccess.Types Namespace (ODP.NET Types), 2 of 17


OracleBinary Structure

The OracleBinary structure represents a variable-length stream of binary data to be stored in or retrieved from a database.

Class Inheritance

Object

  ValueType

    OracleBinary

Declaration
// C#
public struct OracleBinary : IComparable
Thread Safety

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

Example
// C#
// Concatenation of the OracleBinary values using + operator
OracleBinary ob1a = new OracleBinary(new byte[] {1,2,3});
OracleBinary ob1b = new OracleBinary(new byte[] {4});
OracleBinary ob1 = ob1a + ob1b;
OracleBinary ob2 = new OracleBinary(new byte[] {1,2,3,4});
// Output the length if ob1 is equal to ob2
if (ob1 == ob2)
    Console.WriteLine("The OracleBinary structures are equal with length " 
         + ob1.Length);

Requirements

Namespace: Oracle.DataAccess.Types

Assembly: Oracle.DataAccesss.dll

See Also:

OracleBinary Members

OracleBinary members are listed in the following tables:

OracleBinary Constructors

OracleBinary constructors are listed in Table 5-1

Table 5-1 OracleBinary Constructors
Constructor Description

OracleBinary Constructor

Instantiates a new instance of OracleBinary class (Overloaded)

OracleBinary Static Fields

The OracleBinary static fields are listed in Table 5-2.

Table 5-2 OracleBinary Static Fields  
Field Description

Null

Represents a null value that can be assigned to an instance of the OracleBinary structure

OracleBinary Static Methods

The OracleBinary static methods are listed in Table 5-3.

Table 5-3 OracleBinary Static Methods  
Methods Description

Concat

Returns the concatenation of two OracleBinary structures

Equals

Determines if two OracleBinary values are equal (Overloaded)

GreaterThan

Determines if the first of two OracleBinary values is greater than the second

GreaterThanOrEqual

Determines if the first of two OracleBinary values is greater than or equal to the second

LessThan

Determines if the first of two OracleBinary values is less than the second

LessThanOrEqual

Determines if the first of two OracleBinary values is less than or equal to the second

NotEquals

Determines if two OracleBinary values are not equal

OracleBinary Static Operators

The OracleBinary static operators are listed in Table 5-4.

Table 5-4 OracleBinary Static Operators  
Operator Description

operator +

Concatenates two OracleBinary values

operator ==

Determines if two OracleBinary values are equal

operator >

Determines if the first of two OracleBinary values is greater than the second

operator >=

Determines if the first of two OracleBinary values is greater than or equal to the second

operator !=

Determines if two OracleBinary values are not equal

operator <

Determines if the first of two OracleBinary value is less than the second

operator <=

Determines if the first of two OracleBinary value is less than or equal to the second

OracleBinary Static Type Conversion Operators

The OracleBinary static type conversion operators are listed in Table 5-5.

Table 5-5 OracleBinary Static Type Conversion Operators  
Operator Description

explicit operator byte[ ]

Converts an instance value to a byte array

implicit operator OracleBinary

Converts an instance value to an OracleBinary structure

OracleBinary Properties

The OracleBinary properties are listed in Table 5-6.

Table 5-6 OracleBinary Properties  
Properties Description

IsNull

Indicates whether the current instance has a null value

Item

Obtains the particular byte in an OracleBinary structure using an index

Length

Returns the length of the binary data

Value

Returns the binary data that is stored in an OracleBinary structure

OracleBinary Instance Methods

The OracleBinary instance methods are listed in Table 5-7.

Table 5-7 OracleBinary Instance Methods  
Methods Description

CompareTo

Compares the current instance to an object and returns an integer that represents their relative values

Equals

Determines if two objects contain the same binary data (Overloaded)

GetHashCode

Returns a hash code for the current instance

GetType

Inherited from Object

ToString

Converts the current OracleBinary structure to a string

See Also:

OracleBinary Constructor

The OracleBinary constructor instantiates a new instance of the OracleBinary structure and sets its value to the provided array of bytes.

Declaration
// C#
public OracleBinary(byte[ ] bytes); 
Parameters

OracleBinary Static Fields

The OracleBinary static fields are listed in Table 5-8.

Table 5-8 OracleBinary Static Fields  
Field Description

Null

Represents a null value that can be assigned to an instance of the OracleBinary structure

See Also:

Null

This static field represents a null value that can be assigned to an instance of the OracleBinary structure.

Declaration
// C#
public static readonly OracleBinary Null;

See Also:

OracleBinary Static Methods

The OracleBinary static methods are listed in Table 5-9.

Table 5-9 OracleBinary Static Methods  
Methods Description

Concat

Returns the concatenation of two OracleBinary structures

Equals

Determines if two OracleBinary values are equal (Overloaded)

GreaterThan

Determines if the first of two OracleBinary values is greater than the second

GreaterThanOrEqual

Determines if the first of two OracleBinary values is greater than or equal to the second

LessThan

Determines if the first of two OracleBinary values is less than the second

LessThanOrEqual

Determines if the first of two OracleBinary values is less than or equal to the second

NotEquals

Determines if two OracleBinary values are not equal

See Also:

Concat

This method returns the concatenation of two OracleBinary structures.

Declaration
// C#
public static OracleBinary Concat(OracleBinary value1, OracleBinary value2);
Parameters
Return Value

An OracleBinary.

Remarks

If either argument has a null value, the returned OracleBinary structure has a null value.

See Also:

Equals

This method determines if two OracleBinary values are equal.

Declaration
// C#
public static bool Equals(OracleBinary value1, OracleBinary value2);
Parameters
Return Value

Returns true if two OracleBinary values are equal; otherwise returns false.

Remarks

The following rules apply to the behavior of this method.

GreaterThan

This method determines whether the first of two OracleBinary values is greater than the second.

Declaration
// C#
public static bool GreaterThan(OracleBinary value1, OracleBinary value2);
Parameters
Return Value

Returns true if the first of two OracleBinary values is greater than the second; otherwise returns false.

Remarks

The following rules apply to the behavior of this method.

Example
// C#
OracleBinary ob1 = OracleBinary.Null;
OracleBinary ob2 = new OracleBinary(new byte[] {1});
if (OracleBinary.GreaterThan(ob2,ob1))
  Console.WriteLine("ob2 > ob1");

See Also:

GreaterThanOrEqual

This method determines whether the first of two OracleBinary values is greater than or equal to the second.

Declaration
// C#
public static bool GreaterThanOrEqual(OracleBinary value1, OracleBinary value2);
Parameters
Return Value

Returns true if the first of two OracleBinary values is greater than or equal to the second; otherwise returns false.

Remarks

The following rules apply to the behavior of this method.

LessThan

This method determines whether the first of two OracleBinary values is less than the second.

Declaration
// C#
public static bool LessThan(OracleBinary value1, OracleBinary value2);
Parameters
Return Value

Returns true if the first of two OracleBinary values is less than the second; otherwise returns false.

Remarks

The following rules apply to the behavior of this method.

LessThanOrEqual

This method determines whether the first of two OracleBinary values is less than or equal to the second.

Declaration
// C#
public static bool LessThanOrEqual(OracleBinary value1, OracleBinary value2);
Parameters
Return Value

Returns true if the first of two OracleBinary values is less than or equal to the second; otherwise returns false.

Remarks

The following rules apply to the behavior of this method.

NotEquals

This method determines whether two OracleBinary values are not equal.

Declaration
// C#
public static bool NotEquals(OracleBinary value1, OracleBinary value2);
Parameters
Return Value

Returns true if two OracleBinary values are not equal; otherwise returns false.

Remarks

The following rules apply to the behavior of this method.

OracleBinary Static Operators

The OracleBinary static operators are listed in Table 5-10.

Table 5-10 OracleBinary Static Operators  
Operator Description

operator +

Concatenates two OracleBinary values

operator ==

Determines if two OracleBinary values are equal

operator >

Determines if the first of two OracleBinary values is greater than the second

operator >=

Determines if the first of two OracleBinary values is greater than or equal to the second

operator !=

Determines if two OracleBinary values are not equal

operator <

Determines if the first of two OracleBinary value is less than the second

operator <=

Determines if the first of two OracleBinary value is less than or equal to the second

See Also:

operator +

This method concatenates two OracleBinary values.

Declaration
// C#
public static OracleBinary operator + (OracleBinary value1, OracleBinary 
value2);
Parameters
Return Value

OracleBinary

Remarks

If either argument has a null value, the returned OacleBinary structure has a null value.

See Also:

operator ==

This method determines if two OracleBinary values are equal.

Declaration
// C#
public static bool operator == (OracleBinary value1, OracleBinary value2);
Parameters
Return Value

Returns true if they are the same; otherwise returns false.

Remarks

The following rules apply to the behavior of this method.

operator >

This method determines if the first of two OracleBinary values is greater than the second.

Declaration
// C#
public static bool operator > (OracleBinary value1, OracleBinary value2);
Parameters
Return Value

Returns true if the first of two OracleBinary values is greater than the second; otherwise, returns false.

Remarks

The following rules apply to the behavior of this method.

Example
// C#
OracleBinary ob1 = OracleBinary.Null;
OracleBinary ob2 = new OracleBinary(new byte[] {1});
if (ob2 > ob1)
  Console.WriteLine("ob2 > ob1");

See Also:

operator >=

This method determines if the first of two OracleBinary values is greater than or equal to the second.

Declaration
// C#
public static bool operator >= (OracleBinary value1, OracleBinary value2);
Parameters
Return Value

Returns true if the first of two OracleBinary values is greater than or equal to the second; otherwise, returns false.

Remarks

The following rules apply to the behavior of this method.

operator !=

This method determines if two OracleBinary values are not equal.

Declaration
// C#
public static bool operator != (OracleBinary value1, OracleBinary value2);
Parameters
Return Value

Returns true if the two OracleBinary values are not equal; otherwise, returns false.

See Also:

operator <

This method determines if the first of two OracleBinary values is less than the second.

Declaration
// C#
public static bool operator < ( OracleBinary value1, OracleBinary value2);
Parameters
Return Value

Returns true if the first of two OracleBinary values is less than the second; otherwise, returns false.

Remarks

The following rules apply to the behavior of this method.

operator <=

This method determines if the first of two OracleBinary values is less than or equal to the second.

Declaration
// C#
public static bool operator <= (OracleBinary value1, OracleBinary value1);
Parameters
Return Value

Returns true if the first of two OracleBinary values is less than or equal to the second; otherwise, returns false.

Remarks

The following rules apply to the behavior of this method.

OracleBinary Static Type Conversion Operators

The OracleBinary static type conversion operators are listed in Table 5-11.

Table 5-11 OracleBinary Static Type Conversion Operators  
Operator Description

explicit operator byte[ ]

Converts an instance value to a byte array

implicit operator OracleBinary

Converts an instance value to an OracleBinary structure

See Also:

explicit operator byte[ ]

This method converts an OracleBinary value to a byte array.

Declaration
// C#
public static explicit operator byte[ ] (OracleBinary val);
Parameters
Return Value

A byte array.

Exceptions

OracleNullValueException - The OracleBinary structure has a null value.

See Also:

implicit operator OracleBinary

This method converts a byte array to an OracleBinary structure.

Declaration
// C#
public static implicit operator OracleBinary(byte[ ] bytes);
Parameters
Return Value

OracleBinary

See Also:

OracleBinary Properties

The OracleBinary properties are listed in Table 5-12.

Table 5-12 OracleBinary Properties  
Properties Description

IsNull

Indicates whether the current instance has a null value

Item

Obtains the particular byte in an OracleBinary structure using an index

Length

Returns the length of the binary data

Value

Returns the binary data that is stored in an OracleBinary structure

See Also:

IsNull

This property indicates whether the current instance has a null value.

Declaration
// C#
public bool IsNull {get;}
Property Value

Returns true if the current instance has a null value; otherwise returns false.

See Also:

Item

This property obtains the particular byte in an OracleBinary structure using an index.

Declaration
// C#
public byte this[int index] {get;}
Property Value

A byte in the specified index.

Exceptions

OracleNullValueException - The current instance has a null value.

Example
// C#
OracleBinary ob1 = new OracleBinary(new byte[] {4,3,2,1});
Console.WriteLine(ob1[ob1.Length-1]); // Prints the value 1

See Also:

Length

This property returns the length of the binary data.

Declaration
// C#
public int length {get;}
Property Value

Length of the binary data.

Exceptions

OracleNullValueException - The current instance has a null value.

Example
// C#
OracleBinary ob1 = new OracleBinary(new byte[] {4,3,2,1});
Console.WriteLine(ob1.Length); // Prints the value 4

See Also:

Value

This property returns the binary data that is stored in the OracleBinary structure.

Declaration
// C#
public byte[] Value {get;}
Property Value

Binary data.

Exceptions

OracleNullValueException - The current instance has a null value.

See Also:

OracleBinary Instance Methods

The OracleBinary instance methods are listed in Table 5-13.

Table 5-13 OracleBinary Instance Methods  
Methods Description

CompareTo

Compares the current instance to an object and returns an integer that represents their relative values

Equals

Determines if two objects contain the same binary data (Overloaded)

GetHashCode

Returns a hash code for the current instance

GetType

Inherited from Object

ToString

Converts the current OracleBinary structure to a string

See Also:

CompareTo

This method compares the current instance to an object and returns an integer that represents their relative values

Declaration
// C#
public int CompareTo(object obj);
Parameters
Return Value

The method returns a number that is:

Implements

IComparable

Exceptions

ArgumentException - The parameter is not of type OracleBinary.

Remarks

The following rules apply to the behavior of this method.

Example
// C#
OracleBinary ob1 = new OracleBinary(new byte[] {1,1,1,1});
OracleBinary ob2 = new OracleBinary(new byte[] {1});

// append to ob2 while they are not equal
while (ob1.CompareTo(ob2) != 0)
   ob2 = ob2 + ob2;
Console.WriteLine("ob1 == ob2");

See Also:

Equals

This method determines whether an object is an instance of OracleBinary, and has the same binary data as the current instance.

Declaration
// C#
public override bool Equals(object obj);
Parameters
Return Value

Returns true if obj is an instance of OracleBinary, and has the same binary data as the current instance; otherwise, returns false.

Remarks

The following rules apply to the behavior of this method.

GetHashCode

Overrides Object

This method returns a hash code for the OracleBinary instance.

Declaration
// C#
public override int GetHashCode();
Return Value

An int that represents the hash

See Also:

ToString

Overrides Object

This method converts an OracleBinary instance to a string instance.

Declaration
// C#
public override string ToString();
Return Value

string

Remarks

If the current OracleBinary instance has a null value, the returned string "null".

See Also:


Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 2002 Oracle Corporation.

All Rights Reserved.
Go To Table Of Contents
Contents
Go To Index
Index