Last active
February 9, 2018 06:55
-
-
Save SinZ163/9669b4fa098fba5c0f007719e4b78d3f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| public class Program | |
| { | |
| public static void Main(string[] args) | |
| { | |
| var list = new List<Skill<DifficultyPoint>>(); | |
| var reading = new Reading(); | |
| var test1 = new Skill<ReadingPoint>(); | |
| var test2 = new Skill<DifficultyPoint>(); | |
| list.Add(test2); | |
| list.Add(test1); // Argument 1: cannot convert from 'Skill<ReadingPoint>' to 'Skill<DifficultyPoint>' | |
| list.Add(reading); // Argument 1: cannot convert from 'Reading' to 'Skill<DifficultyPoint>' | |
| Console.WriteLine(list); | |
| } | |
| } | |
| class DifficultyPoint {} | |
| class ReadingPoint : DifficultyPoint {} | |
| class Skill<TDiffPoint> where TDiffPoint : DifficultyPoint {} | |
| class Reading : Skill<ReadingPoint> {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| public class Program | |
| { | |
| public static void Main(string[] args) | |
| { | |
| var list = new List<Skill<ReadingPoint>>(); | |
| var reading = new Reading(); | |
| var test1 = new Skill<ReadingPoint>(); | |
| var test2 = new Skill<DifficultyPoint>(); | |
| list.Add(test2); // Argument 1: cannot convert from 'Skill<DifficultyPoint>' to 'Skill<ReadingPoint>' | |
| list.Add(test1); | |
| list.Add(reading); | |
| Console.WriteLine(list); | |
| } | |
| } | |
| class DifficultyPoint {} | |
| class ReadingPoint : DifficultyPoint {} | |
| class Skill<TDiffPoint> where TDiffPoint : DifficultyPoint {} | |
| class Reading : Skill<ReadingPoint> {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment