Generate address of 'private key' from user input
Assuming the private key string in this example is pk
Console.WriteLine(&quot;Enter private key:&quot;);
string pk = Console.ReadLine();
var bitcoinPrivateKey = new BitcoinSecret(pk, Network.Main);

var legacy_address = bitcoinPrivateKey.GetAddress(ScriptPubKeyType.Legacy);

Console.WriteLine(&quot;Legacy Address :&quot; + legacy_address);

And if you want to get p2sh-segwit and bech32 address, add below lines:
var p2shsegwit_address = bitcoinPrivateKey.GetAddress(ScriptPubKeyType.SegwitP2SH);
var nativesegwit_address = bitcoinPrivateKey.GetAddress(ScriptPubKeyType.Segwit);

Console.WriteLine(&quot;P2SH-Segwit Address :&quot; + p2shsegwit_address);
Console.WriteLine(&quot;Bech32 Address :&quot; + nativesegwit_address);