C#에서 구조체 사이즈 가져오기

[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct ColorVertex
{
    public Vector4 PositionRhw;
    public int Color;
    public Single tu, tv;
};
C# 에서 위 구조체의 크기를 가져 가져 오기 위해서
Marshal.SizeOf(ColorVertex)
를 썼더니.. 아래와 같은 에러가 떴다. -_-;;
ColorVertex은(는) '형식'이지만 '변수'처럼 사용됩니다.
위 에러는 말그대로 ColorVertex 는 구조체 형식인데, 변수처럼 사용해서 발생하는 에러이다.

구조체의 크기를 가져 오기 위한 정확한 방법은 아래와 같이 typeof 도 같이 써 줘야 한다.
Marshal.SizeOf(typeof(ColorVertex))

Posted by 라맨땅

2009/07/06 09:10 2009/07/06 09:10
,
Response
No Trackback , No Comment
RSS :
http://www.amidala.user.to/blog/rss/response/66

Trackback URL : http://www.amidala.user.to/blog/trackback/66

Leave a comment
« Previous : 1 : ... 2 : 3 : 4 : 5 : 6 : 7 : 8 : 9 : 10 : ... 57 : Next »

Archives

Authors

  1. 라맨땅

80

29

-30 days

today : 6