インスタンスの比較
Namespace: FVIL.DataAssembly: FVILbasic (in FVILbasic.dll) Version: 3.1.0.0 (3.1.0.17)
Syntax
C# |
---|
public override bool Equals( Object object ) |
Visual Basic |
---|
Public Overrides Function Equals ( object As Object ) As Boolean |
Parameters
- object
- Type: System..::..Object
比較対象のインスタンス
Return Value
Type: Boolean引数に指定されたインスタンスの内容とこのインスタンスの内容を比較します。 インスタンスの型は同一である必要があります。 内容が同一の場合は true を返します。異なる場合は false を返します。 対応しない型が指定された場合は、false を返します。 また、 null が指定された場合も false を返します。
Examples
ソースコード:
【関数の出力】
C# | Copy |
---|---|
// $Revision: 1.2 $ using System; using System.Collections.Generic; using System.Text; using fvalgcli; // FvPluginXXXX attribute requires fvalgcli namespace User.SampleCode { public partial class Matrix { /// <summary> /// インスタンスの比較(等価) /// </summary> [FvPluginExecute] public void Equals() { int rows = 3; int columns = 3; // 1) インスタンスの準備. FVIL.Data.CFviMatrix mat = new FVIL.Data.CFviMatrix(rows, columns); FVIL.Data.CFviMatrix mat2 = new FVIL.Data.CFviMatrix(rows, columns); // 2) 行列の要素の設定. mat[0, 0] = 1.0; mat[0, 1] = 3.0; mat[0, 2] = 3.0; mat[1, 0] = 4.0; mat[1, 1] = -2.0; mat[1, 2] = 1.0; mat[2, 0] = 2.0; mat[2, 1] = 5.0; mat[2, 2] = -1.0; mat2.CopyFrom(mat); bool result = false; // 3) 計算実行. if (mat.Equals( mat2 )) result = true; else result = false; // 確認) 処理結果の出力. if (result) Console.Write("CFviMatrix.Equals -> Success.\n"); else Console.Write("CFviMatrix.Equals -> Failed.\n"); } } } |
Visual Basic | Copy |
---|---|
' $Revision: 1.1 $ Imports System.Collections.Generic Imports System.Text Imports fvalgcli ' FvPluginXXXX attribute requires fvalgcli Namespace SampleCode Public Partial Class Matrix ''' <summary> ''' インスタンスの比較(等価) ''' </summary> <FvPluginExecute> _ Public Overloads Sub Equals() Dim rows As Integer = 3 Dim columns As Integer = 3 ' 1) インスタンスの準備. Dim mat As New FVIL.Data.CFviMatrix(rows, columns) Dim mat2 As New FVIL.Data.CFviMatrix(rows, columns) ' 2) 行列の要素の設定. mat(0, 0) = 1.0 mat(0, 1) = 3.0 mat(0, 2) = 3.0 mat(1, 0) = 4.0 mat(1, 1) = -2.0 mat(1, 2) = 1.0 mat(2, 0) = 2.0 mat(2, 1) = 5.0 mat(2, 2) = -1.0 mat2.CopyFrom(mat) Dim result As Boolean = False ' 3) 計算実行. If mat.Equals(mat2) Then result = True Else result = False End If ' 確認) 処理結果の出力. If result Then Console.Write("CFviMatrix.Equals -> Success." & vbLf) Else Console.Write("CFviMatrix.Equals -> Failed." & vbLf) End If End Sub End Class End Namespace |
CFviMatrix.Equals -> Success.