13.1.6.1 Clone
このインスタンス・メソッドではOracleBFile
オブジェクトのコピーを作成します。
宣言
// C# public object Clone();
戻り値
OracleBFile
オブジェクト。
実装
ICloneable
例外
ObjectDisposedException
- オブジェクトはすでに処理されています。
InvalidOperationException
- OracleConnection
がオープンされていないか、またはオブジェクトの存続中にクローズされています。
備考
複製されたオブジェクトのプロパティ値は、複製元のオブジェクトのプロパティ値と同じです。
例
// Database Setup, if you have not done so yet. /* Log on as DBA (SYS or SYSTEM) that has CREATE ANY DIRECTORY privilege. CREATE OR REPLACE DIRECTORY MYDIR AS 'C:\TEMP'; */ // C# using System; using Oracle.DataAccess.Client; using Oracle.DataAccess.Types; class CloneSample { static void Main() { // Create MYDIR directory object as indicated above and create a file // MyFile.txt with the text ABCDABC under C:\TEMP directory. // Note that the byte representation of the ABCDABC is 65666768656667 string constr = "User Id=scott;Password=tiger;Data Source=oracle"; OracleConnection con = new OracleConnection(constr); con.Open(); OracleBFile bFile1 = new OracleBFile(con, "MYDIR", "MyFile.txt"); // Open the OracleBFile bFile1.OpenFile(); // Prints "bFile1.Position = 0" Console.WriteLine("bFile1.Position = " + bFile1.Position); // Set the Position before calling Clone() bFile1.Position = 1; // Clone the OracleBFile OracleBFile bFile2 = (OracleBFile) bFile1.Clone(); // Open the OracleBFile bFile2.OpenFile(); // Prints "bFile2.Position = 1" Console.WriteLine("bFile2.Position = " + bFile2.Position); // Close the OracleBFile bFile1.CloseFile(); bFile1.Close(); bFile1.Dispose(); // Close the Cloned OracleBFile bFile2.CloseFile(); bFile2.Close(); bFile2.Dispose(); con.Close(); con.Dispose(); } }