[C#] Get a PerformanceCounter using English name

Posted on Leave a commentPosted in C#

Each counter has its own category and name (sometimes also an instance name). To read performance data, we can create an instance like this: var counter = new PerformanceCounter(“IPv4”, “Datagrams/sec”); Unfortunately those names in parameters depend on system language. However, there is a way to get the PerformanceCounter knowing only the English name. WinAPI function PdhLookupPerfNameByIndex gets a […]

[C#] WinRT – how to detect supported IP versions

Posted on Leave a commentPosted in C#, WinRT

To get information about supported IP versions by the network adapter, we need to go through assigned IP addresses and check their types. In WinRT there is NetworkInformation.GetHostNames(), which gets a list of host names associated with the local machine. Then we only need to filter results by the current network adapter id. In general it’s an ability to exchange […]

[C#] Embedded Class Libraries (DLL)

Posted on Leave a commentPosted in C#

Sometimes we need to prepare a single file application, but what if we want to split a code into DLLs or use 3rd party libraries? Fortunately .NET provides an event AssemblyResolve, which allows us to resolve them manually. In this article I will show how to prepare a Windows Forms Application with loading DLLs from resources. First we need to add references […]