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

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

keyboard - C++ GetAsyncKeyState alternative -

android - java.net.UnknownHostException(Unable to resolve host “URL”: No address associated with hostname) -