Код: Выделить всё
using System;
using System.Collections.Generic;
namespace CSharpFundamentals
{
class Program
{
public static void Main(string[] args)
{
var numbers = new List { 1, 2, 3, 4, 5, 6 };
var smallests = GetSmallests(numbers, 3);
foreach (var number in smallests)
Console.WriteLine(number);
}
public static List GetSmallests(List list, int count)
{
var smallests = new List();
while (smallests.Count < count)
{
var min = GetSmallest(list);
smallests.Add(min);
list.Remove(min);
}
return smallests;
}
public static int GetSmallest(List list)
{
// Assume the first number is the smallest
var min = list[0];
for (var i = 1; i < list.Count; i++)
{
if (list[i] > min)
min = list[i];
}
return min;
}
}
}
Код: Выделить всё
csc /debug+ /pdb:Program.pdb Program.cs
Код: Выделить всё
mdbg Program.exe
Код: Выделить всё
MDbg (Managed debugger) v0.0.0.0 started.
Copyright (C) Microsoft Corporation. All rights reserved.
For information about commands type "help";
to exit program type "quit".
run Program.exe
STOP: Breakpoint Hit
located at line 9 in Program.cs
[p#:0, t#:0] mdbg>
Код: Выделить всё
break Program.cs 10
Код: Выделить всё
b Program.cs 10
Ошибка: неверный синтаксис точки останова.
Я проверил меню справки (
Код: Выделить всё
?Подробнее здесь: https://stackoverflow.com/questions/790 ... n-mdbg-exe