I wrote an essay on April 19, 2009, "Timus 1037." Memory Management, the following structure (Structs) is used to represent a "memory block":
struct Block
{
public int Id { get; private set; }
public int Time { get; set; }
public Block(int id, int time) : this() { Id = id; Time = time; }
}
In this structure, the ID represents the number of "memory block", and time represents the "memory block" expiration, which is an automatically implemented property (Auto-implemented properties).
The following is our protagonist Block.cs source program files:
using System;
namespace Skyiv.Ben.Test
{
struct Block
{
public int Id { get; private set; }
public int Time { get; set; }
public Block(int id) : this() { Id = id; }
}
sealed class Test
{
static void Main()
{
Console.WriteLine(new Block(37).Time);
}
}
}
We will compile this C # source file separately under Windows and Linux operating systems.
The version of the Windows operating system looks like this: