loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.5928970236165629","path":"main.cs","file":{"path":"main.cs","content":{"asEncoding":{"base64":"dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYzsKCmNsYXNzIE1haW5DbGFzcyB7CiAgcHVibGljIHN0YXRpYyB2b2lkIE1haW4gKHN0cmluZ1tdIGFyZ3MpIHsKICAgIHZhciBwZXJzb25MaXN0ID0gbmV3IExpc3Q8UGVyc29uPgogICAgewogICAgICBuZXcgUGVyc29uIHtOYW1lPSJGYXRpaCIsIEFnZT0zMSB9LAogICAgICBuZXcgUGVyc29uIHtOYW1lID0iQWxpY2UiLCBBZ2U9MiB9LAogICAgICBuZXcgUGVyc29uIHtOYW1lPSJNZWhtZXQiLCBBZ2U9MzAgfSwKICAgICAgbmV3IFBlcnNvbiB7TmFtZT0iRXJpYyIsIEFnZSA9IDI4ICB9LAogICAgICBuZXcgUGVyc29uIHtOYW1lPSJUYXJpayIsIEFnZSA9IDIyICB9CiAgICB9OwoKICAgIHBlcnNvbkxpc3QuU29ydCgpOwoKICAgIGZvcmVhY2goUGVyc29uIHBlcnNvbiBpbiBwZXJzb25MaXN0KQogICAgewogICAgICBDb25zb2xlLldyaXRlTGluZSgkIntwZXJzb24uTmFtZX0ge3BlcnNvbi5BZ2V9Iik7CiAgICB9CiAgfQoKICBwdWJsaWMgY2xhc3MgUGVyc29uIDogSUNvbXBhcmFibGU8UGVyc29uPiwgSUNvbXBhcmFibGUKICB7CiAgICBwdWJsaWMgc3RyaW5nIE5hbWUgeyBnZXQ7IHNldDsgfQogICAgcHVibGljIGludCBBZ2UgeyBnZXQ7IHNldDsgfQoKICAgIHB1YmxpYyBpbnQgQ29tcGFyZVRvKFBlcnNvbiBvdGhlcikKICAgIHsKICAgICAgaW50IHJlc3VsdCA9IEFnZS5Db21wYXJlVG8ob3RoZXIuQWdlKTsKCiAgICAgIGlmIChyZXN1bHQgPT0gMCkKICAgICAgewogICAgICAgICAgcmVzdWx0ID0gTmFtZS5Db21wYXJlVG8ob3RoZXIuTmFtZSk7CiAgICAgIH0KCiAgICAgIHJldHVybiByZXN1bHQ7CiAgICB9CgogICAgcHVibGljIGludCBDb21wYXJlVG8ob2JqZWN0IG9iaikKICAgIHsKICAgICAgUGVyc29uIHRlbXAgPSAoUGVyc29uKW9iajsKCiAgICAgIHJldHVybiBDb21wYXJlVG8odGVtcCk7CiAgICB9CiAgfQp9"},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.Collections.Generic;

class MainClass {
  public static void Main (string[] args) {
    var personList = new List<Person>
    {
      new Person {Name="Fatih", Age=31 },
      new Person {Name ="Alice", Age=2 },
      new Person {Name="Mehmet", Age=30 },
      new Person {Name="Eric", Age = 28  },
      new Person {Name="Tarik", Age = 22  }
    };

    personList.Sort();

    foreach(Person person in personList)
    {
      Console.WriteLine($"{person.Name} {person.Age}");
    }
  }

  public class Person : IComparable<Person>, IComparable
  {
    public string Name { get; set; }
    public int Age { get; set; }

    public int CompareTo(Person other)
    {
      int result = Age.CompareTo(other.Age);

      if (result == 0)
      {
          result = Name.CompareTo(other.Name);
      }

      return result;
    }

    public int CompareTo(object obj)
    {
      Person temp = (Person)obj;

      return CompareTo(temp);
    }
  }
}