I am trying to add getters and setters to this struct, so I can use it as a listView items source. The problem is, this causes MarshalAs to be invalid thus not allowing compilation. What would the best option be to fix this?
Attribute 'MarshalAs' is not valid on this declaration type. It is only valid on 'field, parameter, return' declarations.**
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct FileExplorerData
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 251)]
public string name { get; set; }
public FILETIME lastwrite { get; set; }
public bool type { get; set; }
public int size { get; set; }
};