以下の内容はhttps://baba-s.hatenablog.com/entry/2019/09/03/230200より取得しました。


【C#】Color32 の代入を簡略化する Deconstruction

ソースコード

using UnityEngine;

public static class Color32Ext
{
    public static void Deconstruct
    (
        this Color32 self,
        out  byte    r,
        out  byte    g,
        out  byte    b
    )
    {
        r = self.r;
        g = self.g;
        b = self.b;
    }

    public static void Deconstruct
    (
        this Color32 self,
        out  byte    r,
        out  byte    g,
        out  byte    b,
        out  byte    a
    )
    {
        r = self.r;
        g = self.g;
        b = self.b;
        a = self.a;
    }
}

使用例

通常

var col = new Color32( 255, 192, 128, 64 );

Deconstruction

var ( r, g, b ) = new Color32( 255, 192, 128, 64 );
var ( r, g, b, a ) = new Color32( 255, 192, 128, 64 );



以上の内容はhttps://baba-s.hatenablog.com/entry/2019/09/03/230200より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14