Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the function of the SizeConst of the array of MarshalAs

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces "what is the function of the SizeConst of the array of MarshalAs". In the daily operation, I believe that many people have doubts about the role of the SizeConst of the array of MarshalAs. The editor consulted all kinds of data and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the question of "what is the use of the SizeConst of the array of MarshalAs?" Next, please follow the editor to study!

[StructLayout (LayoutKind.Sequential)] class CLS {public int id; public float value; [MarshalAs (UnmanagedType.ByValArray,SizeConst=10,ArraySubType=UnmanagedType.Struct)] public Point [] ps; [MarshalAs (UnmanagedType.LPStr)] public string msg; [MarshalAs (UnmanagedType.ByValArray,SizeConst=5,ArraySubType=UnmanagedType.LPStr)] public string [] msgs } Console.WriteLine ("Number of bytes needed by a CLS object: {0}", Marshal.SizeOf (typeof (CLS); CLS cls = new CLS (); string [] s = new string [10]; for (int I = 0 X I < 10 x I +) {s [I] = "demo" + I;} cls.msgs = s For (int iTuno Bandi)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report