相关疑难解决方法(0)

使用==比较两个结构

我试图在C#中使用equals(==)比较两个结构.我的结构如下:

public struct CisSettings : IEquatable<CisSettings>
{
    public int Gain { get; private set; }
    public int Offset { get; private set; }
    public int Bright { get; private set; }
    public int Contrast { get; private set; }

    public CisSettings(int gain, int offset, int bright, int contrast) : this()
    {
        Gain = gain;
        Offset = offset;
        Bright = bright;
        Contrast = contrast;
    }

    public bool Equals(CisSettings other)
    {
        return Equals(other, this);
    }

    public override bool Equals(object obj)
    {
        if …
Run Code Online (Sandbox Code Playgroud)

c# struct equality

48
推荐指数
3
解决办法
5万
查看次数

标签 统计

c# ×1

equality ×1

struct ×1