Hey guys. I have a question about C # classes. I have a Character.cs file in which I create a class.
public class Character { public string Name { get; set; } public string Surname { get; set; } } Later in the main file in the character creation class, I record the data here:
Character.Character character = new Character.Character { Name = CharacterController.LoadCharacterData(player).Result[0].Name, Surname = CharacterController.LoadCharacterData(player).Result[0].Surname }; Data is taken from the database. In another file, I wrote the data in the database
public static bool CreateCharacter(Client player, string name, string surname) { Character.Character character = new Character.Character { Name = name, Surname = surname }; Characters.InsertOneAsync(character); return false; } And now I want to write this data (about the character) into global variables and so that I can use it in any part of the code / in any file. If something is not so explained - ask. I will answer in the comments.