Getters and setters un C# | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Getters and setters un C#

Hello my question is how can I access to a getters and a setter in C#? I’m so used to Java and im so familiarized with its own getters and setters just like this: JAVA: Node node = new Node(); node.getNext(); node.setNext(getNum()); And in the Node class public void getNext(){ return next; } public Node setNext(Node next){ this.next = next; } In C# getters and setters are different, how can i access both?

31st Dec 2020, 7:03 AM
Diego Becerril
Diego Becerril - avatar
1 Answer