What exactly do you expect from people here?
Anything you can use when learning C #? In truth, not all are that many. Of course, there are syntactical differences from C, C ++, Java and Javascript, languages that all look like C #, but are completely different.
.NET, #.
# 1. , , # .NET " ", . , , , , , , #, , , . , # , -, .
, , .
# 2. , .
Enter: .
:
using System;
using System.Threading;
using System.Diagnostics;
namespace ConsoleApplication6
{
class Program
{
static void Main(string[] args)
{
Thread t = new Thread(GCThread);
t.IsBackground = true;
t.Start();
SomeClass sc = new SomeClass();
sc.Test();
Console.Out.WriteLine("Ending");
}
private static void GCThread()
{
while (true)
{
GC.Collect();
}
}
}
public class Disposable : IDisposable
{
public Boolean IsDisposed { get; set; }
public void Dispose()
{
IsDisposed = true;
}
}
public class SomeClass
{
private Disposable _Collectable = new Disposable();
~SomeClass()
{
_Collectable.Dispose();
Console.Out.WriteLine("Finalized");
}
public void Test()
{
Console.Out.WriteLine("Test()");
Disposable c = _Collectable;
Debug.Assert(!_Collectable.IsDisposed);
Thread.Sleep(100);
Console.Out.WriteLine("c.IsDisposed: " + c.IsDisposed);
}
}
}
:
Test()
Finalized
c.IsDisposed: True
Ending
SomeClass .Test. , ( ), _Collectable, , .
( GC ), SomeClass , , finalizer .
, Debug.Assert , IsDisposed false, , , .
, , , . , , .