Skip to content

Commit 9a8ebb7

Browse files
authored
DebuggerDisplay
1 parent 6e0303f commit 9a8ebb7

File tree

4 files changed

+50
-0
lines changed

4 files changed

+50
-0
lines changed

CsharpLangExamples.sln

+6
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArrayPool", "ArrayPool\Arra
7777
EndProject
7878
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MemoryPool", "MemoryPool\MemoryPool.csproj", "{F1C093BB-C3D5-4ABF-B3EB-F05646C11638}"
7979
EndProject
80+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DebuggerDisplay", "DebuggerDisplay\DebuggerDisplay.csproj", "{B4504215-25E4-4539-8024-C125196E13D8}"
81+
EndProject
8082
Global
8183
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8284
Debug|Any CPU = Debug|Any CPU
@@ -231,6 +233,10 @@ Global
231233
{F1C093BB-C3D5-4ABF-B3EB-F05646C11638}.Debug|Any CPU.Build.0 = Debug|Any CPU
232234
{F1C093BB-C3D5-4ABF-B3EB-F05646C11638}.Release|Any CPU.ActiveCfg = Release|Any CPU
233235
{F1C093BB-C3D5-4ABF-B3EB-F05646C11638}.Release|Any CPU.Build.0 = Release|Any CPU
236+
{B4504215-25E4-4539-8024-C125196E13D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
237+
{B4504215-25E4-4539-8024-C125196E13D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
238+
{B4504215-25E4-4539-8024-C125196E13D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
239+
{B4504215-25E4-4539-8024-C125196E13D8}.Release|Any CPU.Build.0 = Release|Any CPU
234240
EndGlobalSection
235241
GlobalSection(SolutionProperties) = preSolution
236242
HideSolutionNode = FALSE
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
</Project>

DebuggerDisplay/Program.cs

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System.Diagnostics;
2+
3+
//
4+
5+
var person = new Person();
6+
7+
person.Id = 73;
8+
person.Name = "İbrahim";
9+
person.Surname = "ATAY";
10+
11+
var p = person;
12+
13+
// [DebuggerDisplay("{𝘋𝘦𝘣𝘶𝘨𝘨𝘦𝘳𝘋𝘪𝘴𝘱𝘭𝘢𝘺}")]
14+
// [DebuggerDisplay("ID: {Id}: Name:{Name} {Surname}")] // ID: 73: Name:"İbrahim" "ATAY"
15+
// [DebuggerDisplay("{DebuggerMessage}")] // "Id:73 Name: İbrahim ATAY"
16+
public class Person
17+
{
18+
public int Id { get; set; }
19+
public string Name { get; set; }
20+
public string Surname { get; set; }
21+
public override string ToString()
22+
{
23+
return $"Id:{Id} Name: {Name} {Surname}";
24+
}
25+
26+
private string DebuggerMessage
27+
{
28+
get
29+
{
30+
return $"Id:{Id} Name: {Name} {Surname}";
31+
}
32+
}
33+
}

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Examples of C# programming, with the goal of tracking and staying up-to-date wit
6060
* C# 4 & others
6161
* [Dynamic types](DynamicTypes/)
6262
* [Multicast Delegates](MulticastDelegates/)
63+
* [DebuggerDisplay](DebuggerDisplay/)
6364

6465
## Notes
6566
- [Which C# version is included in which framework version?](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/configure-language-version)

0 commit comments

Comments
 (0)