Contents
Description
The snippets on this wikipage are written for the .NET Framework v4.0 and higher, but most probably work in older versions. Most will, however not work for .NET Core and .NET Standard.
Package Specific snippits
Package |
Description |
C# Library for Razer Chroma's SDK |
Snippets
override GetHashCode()
Number Remap Class
Custom Events & Handling
CustomEventArgs.cs
Instance.cs
InstanceOwner.cs
IComparable Class
1 public class Mission : IComparable<Mission>, IComparable
2 {
3 public string Name { get; private set; }
4 public DateTime LaunchDate { get; private set; }
5 public DateTime ReturnDate { get; private set; }
6 public string SpaceShip { get; private set; }
7
8 public List<Astronaut> Astronauts { get; private set; }
9
10 public Mission(string name, DateTime launchDate, DateTime returnDate, string spaceShip)
11 {
12 Astronauts = new List<Astronaut>();
13 Name = name;
14 LaunchDate = launchDate;
15 ReturnDate = returnDate;
16 SpaceShip = spaceShip;
17 }
18
19 public int CompareTo(Mission other)
20 {
21 if (ReferenceEquals(this, other)) return 0;
22 if (ReferenceEquals(null, other)) return 1;
23 int nameComparison = string.Compare(Name, other.Name, StringComparison.Ordinal);
24 if (nameComparison != 0) return nameComparison;
25 int launchDateComparison = LaunchDate.CompareTo(other.LaunchDate);
26 if (launchDateComparison != 0) return launchDateComparison;
27 int returnDateComparison = ReturnDate.CompareTo(other.ReturnDate);
28 if (returnDateComparison != 0) return returnDateComparison;
29 return string.Compare(SpaceShip, other.SpaceShip, StringComparison.Ordinal);
30 }
31
32 public int CompareTo(object obj)
33 {
34 if (ReferenceEquals(null, obj)) return 1;
35 if (ReferenceEquals(this, obj)) return 0;
36 if (!(obj is Mission)) throw new ArgumentException($"Object must be of type {nameof(Mission)}");
37 return CompareTo((Mission) obj);
38 }
39 }