How to create a hardlink in C#?

.net, c#, hardlink

Solution

[DllImport("Kernel32.dll", CharSet = CharSet.Unicode )]
  static extern bool CreateHardLink(
  string lpFileName,
  string lpExistingFileName,
  IntPtr lpSecurityAttributes
  );

Usage:

`CreateHardLink(newLinkPath,sourcePath, IntPtr.Zero);`

Problem

How to create a hardlink in C#? Any code snippet, please?

Original source