PROWAREtech
.NET: Retrieve the Executable's Path and Directory
Find the executable's path and its directory by using System.Reflection.Assembly.GetExecutingAssembly().Location
. This will return the path to the executable.
// NOTE: Get the full name path of the executable file
string exeFullName = System.Reflection.Assembly.GetExecutingAssembly().Location;
// NOTE: Get the exe's directory
string dirFullName = System.IO.Path.GetDirectoryName(exeFullName); // NOTE: this will be the directory of the executable which will not be IWebHostEnvironment.ContentRootPath when debugging in Visual Studio
Now use System.IO.Path.Combine()
to work in the executable's directory regardless of the platform.
tutorial
.NET: About the System.Security.Cryptography Namespace
A general overview and explanation about hash, symmetric and asymmetric cryptography algorithms with examples available, like DES symmetric and RSA asymmetric algorithms; written in C#.
.NET: Access the Pixels of an Image Using SixLabors.ImageSharp v3.0
How to access each pixel's color information using SixLabors.ImageSharp, written in C#.
.NET: Add Comment to XML Document
Use the XmlSerializer and XmlDocument classes to add a comment to XML files; written in C#.
.NET: Alpha Compositing Algorithm
How to convert an image with an alpha channel to an image without an alpha channel; written in C#.
.NET: Call an External Function Using DllImport in C#
How to correctly use DllImport to call external functions in libraries on both windows (.dll files) and Linux (.so libraries).
.NET: CNN for Supervised Deep Learning Example in C#
An example one-dimensional and two-dimensional Convolutional Neural Network, deep learning library written in C#.
.NET: Common Activation Functions with Their Derivatives in C#
The neural network activation functions Rectified Linear Unit (ReLU), Leaky Rectified Linear Unit, Exponential Linear Unit (ELU), Hyperbolic Tangent (tanh), and Sigmoid with the derivates for each.
.NET: Convert Dictionary Keys and Values to a List
How to create a list from either the keys or the values of a dictionary in C#.
.NET: Convert Double Array to Byte Array
How to use the BitConverter class to convert an array of doubles to an array of bytes and back again; written in C#.
.NET: Convert Float Array to Byte Array
How to use the BitConverter class to convert an array of floats to an array of bytes and back again; written in C#.
.NET: Convert Int Array to Byte Array
How to use the BitConverter class to convert an array of integers (int) to an array of bytes and back again; written in C#.
.NET: Convert Number to Binary String
How to convert a number such as an int, uint, long, ulong or other integer to a binary string using C#.
.NET: Create, Read from and Write to Processes
Examples of creating processes and how to read console output and write to a console using the System.Diagnostics.Process class and use Windows Management Instrumentation (WMI) to create processes on remote machines; written in C# and VB.NET.
.NET: Crop Image to Square using SixLabors.ImageSharp v3.0
Use SixLabors.ImageSharp to crop an image to a square, written in C#.
.NET: Double to String Conversion Without Scientific Notation
How to print double values without using scientific notation, in C#.
.NET: Download any Type of File Data from a URL with HttpClient
Download a file from an Internet URL/URI using the HttpClient class; written in C#.
.NET: Extract the Page Title from HTML
How to find the title in an HTML page using regular expressions (RegEx) in C#.
.NET: Find Keywords in Text using Regex
How to find a keyword in text using C# and regular expressions.
.NET: Find the Index Value When Using LINQ Select()
How to know the current index value of an item when using the Language Integrated Query Select() method; example in C#.
.NET: Globally Unique Identifiers
The GUID is great for anything requiring uniqueness; examples in C# and VB.NET.
.NET: Hash-based Message Authentication Code
Safely store user passwords, written in C#.
.NET: How to Create WordPress Slugs
Use C# regular expressions (Regex) to create slugs with only standard characters for use in a URL or other purpose.
.NET: How to Randomize the Order of a List and Optional Parallel List
Using C#, randomize or shuffle a list, and optionally, a second, parallel list.
.NET: Image Utility for SixLabors.ImageSharp v1.0
Manipulate images on Windows, Linux and MacOS machines including creating a scatter plot and histogram, and rotating the images as needed to display properly with a C# console application example.
.NET: Image Utility for SixLabors.ImageSharp v3.0
Manipulate images on Windows, Linux and MacOS machines including creating a scatter plot and histogram, and rotating the images as needed to display properly with a C# console application example.
.NET: Is a Number a Power of Two (2)
How to check or determine if a number has a base of 2 without using modulo operations for maximum performance; written in C#.
.NET: Join/Merge Two List, Array or Enumerable (IEnumerable) Objects
How to combine Lists, Arrays or Enumerables and, optionally, make them unique or distinct using C#.
.NET: Kill or End a Process
How to terminate a process using C#.
.NET: Lazy Load Data
How to lazy load data using the C# programming language.
.NET: Machine Learning, Unsupervised Learning or Clustering, K-mean / Silhouette Clustering Library
An example of a machine learning library, or utility, written in C#.
.NET: Memory-Mapped Files
Memory-mapped files allow sharing large amounts of data between processes; they are explored here with examples in C#.
.NET: Mersenne Twister Random Number Generation
A popular Mersenne Twister pseudo random number generator example written in C#.
.NET: Multi-threading with Tasks
How to multi-thread using the Task class in C#.
.NET: Neural Network, Supervised Deep Machine Learning Example in C#
An example neural network, deep learning library written in C#; categorizes practically any data as long as it is properly normalized.
.NET: Nvidia CUDA for CSharp (v1.0.1 - Linux Edition)
Access Nvidia CUDA functionality from the C# language (as well as VB.NET) on a Linux x64 machine using this simple wrapper library.
.NET: Nvidia CUDA for CSharp (v1.0.1)
Access Nvidia CUDA functionality from the C# language (as well as VB.NET) on Windows 64-bit (x64) using this simple wrapper library.
.NET: Operating System Detection
How to detect if the operating system is Linux, MacOS or Windows using C#.
.NET: Power Status - AC/DC
How to detect the DC/battery operation or AC/plugged-in operation of the computer using C#.
.NET: Retrieve the Executable's Path and Directory
How to find the .NET executable's path and directory using the C# programming language.
.NET: Reverse Geocode
Use latitude and longitude to reverse-geocode to country, US state/Canadian province and time zone in a .NET application all while offline; written in C#.
.NET: Sort a List of Objects with a Delegate Function
How to use a delegate to sort a C# List Holding Objects Instead of Primitive Types.
.NET: Strip/Remove HTML SCRIPT Tags from Text Using Regex
How to remove the SCRIPT tag and its containing code from HTML text using C# and regular expressions.
.NET: Strip/Remove HTML Tags from Text Using Regex
How to remove the tags from HTML text using C# and regular expressions.
.NET: Use Callback Function with Windows API
How to use a callback function with the Windows API or any C/C++ DLL that exports a function requiring a callback function as a parameter in C#.
.NET: Using Brotli to Compress and Decompress Data
How to use the BrotliStream class to compress and decompress bytes, files or streams of data in C#.
.NET: Using GZip to Compress and Decompress Data
How to use the GZipStream class to compress and decompress bytes, files and streams of data in C#.
.NET: What's New or Changed in C# 6
A guide to the changes and additions in C# version 6.
.NET: What's New or Changed in C# 7
A guide to the changes and additions in C# version 7.
.NET: Working with Arrays
How to sort and work with parallel arrays in C#.
.NET: Working with Dates
Working with the Date object and the TimeSpan object written in C#.
.NET: Working with Strings
The StringBuilder class versus String.Format() plus common formatting parameters for dates and numbers written in C#.
.NET: Working with Threads
How to use the Thread class in C#.
.NET: XmlSerializer Example
Serialize and deserialize objects to XML strings using C#.