ToString() public method

public ToString ( ) : string
return string
示例#1
0
文件: Mobile.cs 项目: HLPK/Tasks
        private string GetDescription(KeyBoardBase keyBoard)
        {
            var descrioptionBuilder = new StringBuilder();

            descrioptionBuilder.Append($"Keyboard: {Keyboard.ToString()}");
            return(descrioptionBuilder.ToString());
        }
示例#2
0
文件: Mobile.cs 项目: HLPK/Tasks
        public string GetDescription()
        {
            var descrioptionBuilder = new StringBuilder();

            descrioptionBuilder.Append($"ID: {ID}; ");
            descrioptionBuilder.Append($"Screen Type: {Screen.ToString()}; ");
            descrioptionBuilder.Append($"Keyboard: {Keyboard.ToString()}");
            return(descrioptionBuilder.ToString());
        }
示例#3
0
        public string GetDescription()
        {
            var descriptionBuilder = new StringBuilder();

            descriptionBuilder.AppendLine($"ScreenType:{Screen.ToString()}");
            descriptionBuilder.AppendLine($"Battery: {Battery.ToString()}");
            descriptionBuilder.AppendLine($"Keyboard:{Keyboard.ToString()}");
            descriptionBuilder.AppendLine($"SimCard:{ Simcard.ToString()}");
            return(descriptionBuilder.ToString());
        }
示例#4
0
        public override string ToString()
        {
            var descriptionBuilder = new StringBuilder();

            descriptionBuilder.AppendLine($"Screen Type: {Screen.ToString()}");
            descriptionBuilder.AppendLine($"Keyboard Type: {Keyboard.ToString()}");
            descriptionBuilder.AppendLine($"Battery Type: {Battery.ToString()}");
            descriptionBuilder.AppendLine($"Slot Type: {Slot.ToString()}");
            return(descriptionBuilder.ToString());
        }
示例#5
0
 public void GetInformationDevice()
 {
     Console.WriteLine(
         $"Keyboard: {keyboard.ToString()}\n" +
         $"Display: {display.ToString()}\n" +
         $"TouchPad: {touchPad.ToString()}\n" +
         $"CPU: {cpu.ToString()}\n" +
         $"RAM: {ram.ToString()}\n" +
         $"ROM: {rom.ToString()}"
         );
 }
示例#6
0
        public string GetDescription()
        {
            var descriptionBuilder = new StringBuilder();

            descriptionBuilder.AppendLine($"Battery: {Battery.ToString()}");
            descriptionBuilder.AppendLine($"Speaker: {Speaker.ToString()}");
            descriptionBuilder.AppendLine($"Keyboard: {Keyboard.ToString()}");
            descriptionBuilder.AppendLine($"Microphone: {Microphone.ToString()}");
            descriptionBuilder.AppendLine($"Screen: {Screen.ToString()}");
            descriptionBuilder.AppendLine($"Simcard: {Simcard.ToString()}");
            return(descriptionBuilder.ToString());
        }
示例#7
0
        public override string ToString()
        {
            var descriptionBuilder = new StringBuilder();

            descriptionBuilder.AppendLine($"Screen Type: {Screen.ToString()}");
            descriptionBuilder.AppendLine($"Dynamic Type: {Speaker.ToString()}");
            descriptionBuilder.AppendLine($"Battery Type: {Battery.ToString()}");
            descriptionBuilder.AppendLine($"Keyboard Type: {Keyboard.ToString()}");
            descriptionBuilder.AppendLine($"Microphone Type: {Microphone.ToString()}");
            descriptionBuilder.AppendLine($"Simcard Type: {SimCard.ToString()}");

            return(descriptionBuilder.ToString());
        }
        public void CreateSimCorpMobile()
        {
            Screen = defineScreen();

            int ktype = defineEnumParam(typeof(KeybordType));
            int ltype = defineEnumParam(typeof(Language));

            Keyboard = new Keyboard(ktype, ltype);

            Console.WriteLine("Enter battery capacity");
            int bcapacity = Convert.ToInt32(Console.ReadLine());
            int btype     = defineEnumParam(typeof(BatteryType));

            Battery = new Battery(bcapacity, (BatteryType)btype);

            int stype = defineEnumParam(typeof(SimFormat));

            SimCard = new SimCard(stype);

            int ostype = defineEnumParam(typeof(OStype));

            OperatingSystem = new MobilePhoneComponents.OperatingSystem(ostype);

            Console.WriteLine("Enter camera quality (MPx)");
            double cquality = Convert.ToDouble(Console.ReadLine());

            Console.WriteLine("Choose autofocus (false/true)");
            bool cautofocus = Convert.ToBoolean(Console.ReadLine());

            Console.WriteLine("Choose flash (false/true)");
            bool cflash = Convert.ToBoolean(Console.ReadLine());

            Camera = new Camera(cquality, cautofocus, cflash);


            Console.WriteLine("_______________________");
            Console.WriteLine("Defined parameters:");
            Console.WriteLine(Screen.ToString());
            Console.WriteLine(Keyboard.ToString());
            Console.WriteLine(Battery.ToString());
            Console.WriteLine(SimCard.ToString());
            Console.WriteLine(OperatingSystem.ToString());
            Console.WriteLine(Camera.ToString());
        }
示例#9
0
        public override string ToString()
        {
            var           itemToString = string.Empty;
            StringBuilder sb           = new StringBuilder();

            sb.Append("Desktop PC Specs:");
            sb.Append(string.Format("\t {0}", Case.ToString()));
            sb.Append(string.Format("\t {0}", Cooler.ToString()));
            sb.Append(string.Format("\t {0}", CPU.ToString()));
            sb.Append(string.Format("\t {0}", GPU.ToString()));
            sb.Append(string.Format("\t {0}", HDD.ToString()));
            sb.Append(string.Format("\t {0}", Keyboard.ToString()));
            sb.Append(string.Format("\t {0}", Monitor.ToString()));
            sb.Append(string.Format("\t {0}", MotherBoard.ToString()));
            sb.Append(string.Format("\t {0}", Mouse.ToString()));
            sb.Append(string.Format("\t {0}", PSU.ToString()));
            sb.Append(string.Format("\t {0}", RAM.ToString()));
            itemToString = sb.ToString();
            return(itemToString);
        }
示例#10
0
        static void Main(string[] args)
        {
            Console.WriteLine("---Klasa abstrakcyjna i polimorfizm---\n");

            Student s1 = new DomesticStudent("Jacek", "Kowalczyk", "Poland", "s1345", 15, 0);
            Student s2 = new ForeignStudent("Robert", "Muller", "Germany", "s1077");

            Console.WriteLine(s1.CalculateYearlyTuitionFee());
            Console.WriteLine(s2.CalculateYearlyTuitionFee());

            Console.WriteLine("\n---Dziedziczenie overlapping---\n");

            EventParticipant t1 = new EventParticipant("Tomasz", "Kowalski", "Poland", new DateTime(2000, 11, 30), new List <ParticipationType> {
                ParticipationType.Player
            }, null, "21");
            EventParticipant t2 = new EventParticipant("Grzegorz", "Lewandowski", "Poland", new DateTime(1976, 01, 06), new List <ParticipationType> {
                ParticipationType.Referee
            }, "S982EV", null);
            EventParticipant t3 = new EventParticipant("Paweł", "Nowak", "Poland", new DateTime(1988, 06, 14), new List <ParticipationType> {
                ParticipationType.Player, ParticipationType.Referee
            }, "A317B", "33");

            Console.WriteLine(t1.isPlayer());
            Console.WriteLine(t1.isReferee());
            Console.WriteLine(t1.ToString());

            Console.WriteLine(t2.isPlayer());
            Console.WriteLine(t2.isReferee());
            Console.WriteLine(t2.ToString());

            Console.WriteLine(t3.isPlayer());
            Console.WriteLine(t3.isReferee());
            Console.WriteLine(t3.ToString());

            Console.WriteLine("\n---Dziedziczenie dynamiczne---\n");

            Account acc1 = new AccountPremium("Thomas", new DateTime(2020, 05, 11), "England", new MailAddress("*****@*****.**"), new DateTime(2020, 05, 20), SubscriptionType.Silver);
            Account acc2 = new AccountNormal("Janeq", new DateTime(2018, 09, 29), "Poland", new MailAddress("*****@*****.**"));

            Console.WriteLine(acc1.ToString());
            Console.WriteLine(acc2.ToString());

            acc1 = new AccountNormal(acc1);
            acc2 = new AccountPremium(acc2, new DateTime(2019, 10, 24), SubscriptionType.Diamond);

            Console.WriteLine(acc1.ToString());
            Console.WriteLine(acc2.ToString());

            acc1 = new AccountPremium(acc1, new DateTime(2020, 05, 20), SubscriptionType.Silver);

            Console.WriteLine(acc1.ToString());

            Console.WriteLine("\n---Wielodziedziczenie---\n");

            Car c1 = new CombustionCar("Lamborghini Huracan", 610, 2016, 11.0, 83);
            Car c2 = new ElectricCar("BMW i3", 170, 2013, 260.0, 13.1);
            Car c3 = new HybridCar("Toyota C-HR", 122, 2017, 3.6, 43, 50.0, 2.0);

            Console.WriteLine(c1.CalculateNeededUnit(250.00));
            Console.WriteLine(c2.CalculateNeededUnit(250.00));
            Console.WriteLine(c3.CalculateNeededUnit(250.00) + "\n");

            Console.WriteLine(c3.ToString());

            Console.WriteLine("\n---Wieloaspektowe---\n");

            Device d1 = new Device("JBL", "Flip 5", "Blue", 12);
            Device d2 = new Device("Steelseries", "Arctis 5", "Black", 3.0);

            Mouse    m1 = new Mouse("Logitech", "G PRO", "Black", 7, 25600);
            Keyboard k1 = new Keyboard("Razer", "Huntsman", "Black", SwitchType.Mechanical, true);

            Console.WriteLine(d1.GetConnection());
            Console.WriteLine(d2.GetConnection() + "\n");

            Console.WriteLine(d1.ToString());
            Console.WriteLine(d2.ToString());
            Console.WriteLine(m1.ToString());
            Console.WriteLine(k1.ToString());
        }
示例#11
0
        public static void HandleKeyRelease(Keyboard.Key searchKey)
        {
            string ReleaseAction = null;
            Console.WriteLine("Keys released:");

            if (searchKey != Keyboard.Key.Unknown)
                Console.WriteLine("Key - " + searchKey);

            foreach (string line in AllBindings.Bindings)
            {
                    if (line.Contains(searchKey.ToString() + ':'))
                    {
                        ReleaseAction = line.Substring(line.LastIndexOf(':') + 1);
                    }
            }

            if(ReleaseAction != null) ActionMap.ReleaseAction(ReleaseAction);
            ResetActions();
        }