Hello. I'm trying to export a class into another class, and I am getting error CS0103 in the receiving class. Much thanks in advance!
Windows Forms App (.NET Framework) C#
namespace DM
{
public class RandomNameGenerator
{
public class CharacterExportTemplate
{
public string title;
public string firstname;
public string lastname;
public string Title
{
get { return title; }
set { title = value; }
}
public string Firstname
{
get { return firstname; }
set { firstname = value; }
}
public string Lastname
{
get { return lastname; }
set { lastname = value; }
}
}
CharacterExportTemplate characterexport = new CharacterExportTemplate();
return characterexport;
}
This is the receiving class.
{
public class RandomCharacterGenerator
{
string characterFilePath = ConfigurationManager.AppSettings["CharacterFilePath"].ToString();
RandomNameGenerator randomnamegenerator = new RandomNameGenerator();
int nm;
public struct CharacterTemplate
{
public string firstname;
public string lastname;
public string title;
public string background;
public int st;
public int con;
public int dex;
public int intel;
public int wis;
public int ch;
}
public CharacterTemplate CreateCharacter()
{
CharacterTemplate character = new CharacterTemplate();
RandomNameGenerator namegenerator = new RandomNameGenerator();
character.title = characterexport.title; << The error is on these three lines,
character.lastname = characterexport.firstname; << on characterexport.
character.lastname = characterexport.lastname;
<<