I have a question that interests me, what would be better in terms of programming: use Class members
or Getter
from inside the My Class?
for example this is my class:
public class myClass
{
private string _name;
private int _length;
private int _weight;
public void doSomething(myClass obj)
{
}
public void doSomething2(myClass obj)
{
}
public string name
{
get { return _name; }
}
public int length
{
get { return _length; }
}
public int weight
{
get { return _weight; }
}
}
using doSomething in this way:
public void doSomething(string str, myClass obj)
{
string[] arr = str.Split(' ');
arr[1] = obj._name;
arr[2] = obj._length;
arr[3] = obj._weight;
}
or this way:
public void doSomething2(string str, myClass obj)
{
string[] arr = str.Split(' ');
arr[1] = obj.name;
arr[2] = obj.length;
arr[3] = obj.weight;
}