using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
// Marshal 域名空间
using System.Runtime.InteropServices;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
int num_Size = sizeof(Int32);// 16->2,32->4,64->8
SetText("Int32 Size sizeof =" + num_Size);
People pp = new People();
// Marshal.SizeOf用于引用类型,非托管
var size = Marshal.SizeOf
本文探讨了C#编程中不同类型的变量在内存中占用的大小,通过讲解和实例解析了如何使用Marshal类来计算变量的大小。
订阅专栏 解锁全文
338

被折叠的 条评论
为什么被折叠?



