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? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -