Pointer to struct in C# to create a linked list -
c# not pointers, need use them create linked list, in c. struct simple:
public unsafe struct livro { public string name; public livro* next; } but error: "cannot take address of, size of, or declare pointer managed type". ideas?
you can use class instead of struct:
public class livro { public string name { get; set; } public livro next { get; set; } } this provide proper behavior automatically.
that being said, might want use linkedlist<t> class framework directly.
Comments
Post a Comment