본문 바로가기
카테고리 없음

c# 네임드 튜플(짧게)

by 하타라시 2023. 8. 22.

    public static (int hello,int test22) GetAttackPos()
    {
        return (0, 0);
    } 

라는 메소드가 있다고할때,

        

        //네임드 튜플
        var namedTuple = (hello: 1, test22: 2);
        Debug.Log($"{namedTuple.hello} / {namedTuple.test22}");

        namedTuple = GetAttackPos();
        Debug.Log($"{namedTuple.hello} / {namedTuple.test22}");

 

이런식으로 활용가능한듯허다,, 귀찮어서 값 출력까진 안했는데, 아마도 얼추되는듯,,

 

참고한 글 

https://honsal.blogspot.com/2018/07/clinqtuple-linq-named-tuple.html