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


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

ソースコード

using UnityEngine;

public static class ColorExt
{
    public static void Deconstruct
    (
        this Color self,
        out  float r,
        out  float g,
        out  float b
    )
    {
        r = self.r;
        g = self.g;
        b = self.b;
    }

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

使用例

通常

var col = Color.white;

Deconstruction

var ( r, g, b ) = Color.white;
var ( r, g, b, a ) = Color.white;



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

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