So I'm trying some C#. I want a class that takes strings as constructor arguments when an object is created. Then the strings are to be stored within the class. Something like this:
public class DVD
{
public string sTitle, sName, sType;
public int iLength=0;
DVD(string title, string name, string type, int length)
{
sTitle = title;
sName = name;
sType = type;
}
};
As of what I've understood, the strings are just references. That's probably the reason why I get the error messages:
Warning 2 Field 'DVDsorter.DVD.sName' is never assigned to, and will always have its default value null
I tried to do things like
sTitle = new String(title);
and
sTitle = new String;
sTitle = title;
with no success.
Some useful background information could be that I'm about to read information about DVD's line by line from a textfile, and then save each DVD as objects from the DVD class above. This means that I want to deepcopy the information.
How do I best solve this probably very simple task?