Hi,
Am trying to use pointers on structures in c#.
A separate class file. (the class file contains only strucutres, and the class has been removed.
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct strEmployee : INotifyPropertyChanged
{
[MarshalAs(UnmanagedType.Struct)]
int _EmpNo;
public int EmpNo
{
get { return _EmpNo; }
set
{
_EmpNo = value;
PropertyValueChanged("EmpNo");
}
}
}
In my MainWindow.XAML.cs, i try to give a pointer to strEmployee structure, i get a compile time error 'Cannot take the address of, get the size of, or declare a pointer to a managed type.'
on line strEmployee* pStructEmp in
unsafe
{
strEmployee* pStructEmp;
}
The build option on project properties has been checked for Allow unsafe code.
any help appreciated, thanks in advance.