Exemple #1
0
        private void buttonLoad_Click(object sender, EventArgs e)
        {
            openFileDialog.InitialDirectory = Directory.GetCurrentDirectory();
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                var FileName = new StringBuilder(openFileDialog.FileName);
                int n        = GetFileSize(FileName);
                var FileData = new StringBuilder(n);
                GetFile(FileName, FileData);
                textBox.Text = FileData.ToString();

                var s = new SharpStruct();
                s.i = 100;
                s.d = 200;
                s.s = "String from Sharp";
                GetStruct(ref s);
                listBox.Items.Add($"{s.i}");
                listBox.Items.Add($"{s.d}");
                listBox.Items.Add($"{s.s}");
            }
        }
Exemple #2
0
 static extern void GetStruct(ref SharpStruct s);