好了,爲了使複雜標題更加清晰:我有一個通用元組的單例聯合。該類型還會使相等運算符重載,以便使Edge (1, 2)等效於Edge (2, 1)。 type Edge<'a> = Edge of 'a * 'a
with
static member (=) (e1: Edge<_>, e2: Edge<_>) =
match e1, e2 with
我已經在裏面定義了一個帶有傳遞函數的數組。我怎樣才能找到該陣列中某個傳遞函數的位置? s = tf('s') % defining a transfer function
array = [s, s^2, s^3];
>> find(array==s)
undefined function 'eq' for input arguments of type 'tf'.
我有下面的類 public class ResourceInfo
{
public string Id { get; set; }
public string Url { get; set; }
}
其中包含的一些資源信息。 現在,我需要檢查,如果兩個這樣的資源是由以下情形相等(I`ve實現IEquatable接口) public class ResourceInfo
這裏是我在類中實現==和!=運算符。 public class MyClass
{
public int FirstField { get; set; }
public int SecondField { get; set; }
public static bool operator ==(MyClass first, MyClass