Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Delegate, Method, List, Classes, Conditions
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { delegate bool IsPromotable(Employee emp); class Program { public static void Main(string[] args) { List<Employee> emplist = new List<Employee>(); emplist.Add(new Employee() { ID = 100, name = "Farhad", Salary = 10, Experience = 2 }); emplist.Add(new Employee() { ID = 200, name = "Alam", Salary = 20, Experience = 1 }); IsPromotable isPromotable = new IsPromotable(promote); Employee.PromoteEmployee(emplist, isPromotable); } public static bool promote(Employee emp) { if (emp.Experience >= 2) { return true; } else { return false; } } } class Employee { public int ID { get; set; } public string name { get; set; } public int Salary { get; set; } public int Experience { get; set; } public static void PromoteEmployee(List<Employee> list, IsPromotable s) { for (int i = 0; i < 2; i++) { if (s(list[i])) { Console.WriteLine(list[i].name + " is Promoted"); } } } } }
run
|
edit
|
history
|
help
0
Singleton Example
aaaaa
UUEncode, UUDecode, XXEncode or XXDecode a string.
Quarter Hour String Generator
ladly
EVEN AND ODD
FizzBuzz Solution
return whether any two numbers from the list add up to k
xddd
count the occurrence of each distinct item in the array - Seeni