This file contains 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
public static void Main(params string[] args) | |
{ | |
// String dönüş tipli parametre almayan bir method: | |
Func<string> findName = () => | |
{ | |
return "World"; | |
} | |
// String tipinde bir parametre alan değer döndürmeyen (void) bir method: | |
Action<string> sayHello = (name) => |
This file contains 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
IDataProvider<string> a = default; // Or something else... | |
IDataProvider<object> b = a; // ✔ There is no compile error! Everything is ok 👌. |
This file contains 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
public interface IDataProvider<out TData> | |
{ | |
TData GetData(); | |
} |
This file contains 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
interface MyInterface<in T> | |
{ | |
T GetData(); // ❌This can't be used! MsBuild does'nt allow to build! | |
void SetData(T data); // ✔ Everything is OK! | |
} |
This file contains 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
interface MyInterface<in T> | |
{ | |
} |
This file contains 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
public interface MyInterface<out T> | |
{ | |
T GetData(); // ✔That's OK | |
void SetData(T data); // ❌This can't be used! MsBuild does'nt allow to build! | |
} |
This file contains 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
interface MyInterface<out T> | |
{ | |
} |
This file contains 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
IEnumerable<string> a = default; // Or something else... | |
IEnumerable<object> b = a; //✅Everything is OK |
This file contains 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
IDataProvider<string> a = default; // Or something else... | |
IDataProvider<object> b = a; // ❌Compile Error! Can't build. |
This file contains 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
public class BaseClass | |
{ | |
public int Id { get; set; } | |
} | |
public class SubClass : BaseClass | |
{ | |
public string SomeData { get; set; } | |
} |