/// <summary>
        /// Gets a table
        /// </summary>
        public virtual IQueryable<T> Table
        {
            get
            {
                return this.Entities;
            }
        }
        /// <summary>
        /// Gets a table with "no tracking" enabled (EF feature) Use it only when you load record(s) only for read-only operations
        /// </summary>
        public virtual IQueryable<T> TableNoTracking
        {
            get
            {
                return this.Entities.AsNoTracking();
            }
        }In Java, all non-static methods are by default "virtual functions." Only methods marked with the keyword final, which cannot be overridden, along with private methods, which are not inherited, are non-virtual.
void Main()
{
	new B("name");
}
class A
{
    public A()
	{
	     Method();
	}
	
	protected virtual void Method()
	{
	}
}
class B : A
{
    private string Property { get; set; }
	
	public B(string value)
	{
	    Property = value;
	}
	
    protected override void Method()
	{
	    Console.WriteLine(Property.Length);
	}
}addAgent.AddAgentMain(TextBoxSurName.Text);
ButtonAddAgent.Click += new System.EventHandler(AddAgent1);private void newAgent()
{
    Button ButtonAddAgent = new Button();
    ButtonAddAgent.Text = "Добавить агента";
    ButtonAddAgent.AutoSize = true;
    ButtonAddAgent.Location = new System.Drawing.Point(290, 200);
            
    ButtonAddAgent.Click += new System.EventHandler(AddAgent1);
    addAgent.OnAddAgent += AddAgent2;
    splitContainer1.Panel2.Controls.Add(ButtonAddAgent);
}
private void AddAgent1 (object sender, EventArgs e)
{
    MessageBox.Show("Before firing OnAddAgent event");
    addAgent.AddAgentMain(TextBoxSurName.Text);
}
private void AddAgent2(object sender, AddAgentEventArgs e)
{
    Console.WriteLine("Inside OnAddAgent event handler");
    MessageBox.Show(e.AddAgentInfo);
}public void AddAgentMain(string test)
{
    var handler = OnAddAgent;
    if (handler != null)
    {
        // Создаём объект аргумента события и помещаем в него текст письма
        var e = new AddAgentEventArgs { AddAgentInfo = test };
        handler(this, e);
    }
}public void AddAgentMain(string test)
{
    // Создаём объект аргумента события и помещаем в него текст письма
    var e = new AddAgentEventArgs { AddAgentInfo = test };
    OnAddAgent?.Invoke(this, e);
}<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApplication1"
        mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="525">
    <Button Click="Button_Click">
        <ToggleButton Click="ToggleButton_Click" />
    </Button>
</Window>private void Button_Click(object sender, RoutedEventArgs e)
{
    MessageBox.Show("Button clicked");
}
private void ToggleButton_Click(object sender, RoutedEventArgs e)
{
    MessageBox.Show("ToggleButton clicked");
    e.Handled = true;
}class Employee
{
	public int Id { get; set; }
	public string Name { get; set; }
	public int CompanyId { get; set; }
	
	public override string ToString()
	{
		return string.Format("Employee Id = {0}, Name = {1}, CompanyId = {2}", Id, Name, CompanyId);
	}
}
void Main()
{
	var employees = new Employee[] {
	    new Employee() {Id = 1, Name = "Tim", CompanyId = 1111111},
	    new Employee() {Id = 2, Name = "Jack", CompanyId = 126555},
	    new Employee() {Id = 3, Name = "Tim", CompanyId = 1111111},
	    new Employee() {Id = 4, Name = "Kris", CompanyId = 59911919},
	    new Employee() {Id = 5, Name = "Tim", CompanyId = 1111111},
	    new Employee() {Id = 6, Name = "John", CompanyId = 1111111},
	    new Employee() {Id = 7, Name = "Kim", CompanyId = 1111111},
	    new Employee() {Id = 8, Name = "Clark", CompanyId = 9984848},
	};
	
	var filtered = from emp in employees group emp by emp.CompanyId into g where g.Count() == 1 select g.FirstOrDefault();
	
	foreach (var emp in filtered)
	{
	    Console.WriteLine(emp);
	}
}#include <exception>
extern "C" {
    __declspec(dllexport) void CrashTest()
    {
        std::exception* ex = 0;
        ex->what();
    }
}class Program
    {
        [DllImport("PInvokeCrashTest.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern void CrashTest();
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += (s, e) =>
                {
                    Console.WriteLine(string.Format("EXCEPTION: {0}", e.ExceptionObject.ToString()));
                    Process.GetCurrentProcess().Kill();
                };
            CrashTest();
        }
    }Unhandled Exception: System.AccessViolationException: Attempted to read or write
protected memory. This is often an indication that other memory is corrupt.
at ExceptionTest.Program.CrashTest()
at ExceptionTest.Program.Main(String[] args) in d:\PInvokeCrashTest\Exception
Test\Program.cs:line 25
<runtime>
	<legacyCorruptedStateExceptionsPolicy enabled="true" />
</runtime>EXCEPTION: System.AccessViolationException: Attempted to read or write protected
memory. This is often an indication that other memory is corrupt.
at ExceptionTest.Program.CrashTest()
at ExceptionTest.Program.Main(String[] args) in d:\PInvokeCrashTest\Exception
Test\Program.cs:line 24