Assuming the private key string in this example is pk
Console.WriteLine("Enter private key:");
string pk = Console.ReadLine();
var bitcoinPrivateKey = new BitcoinSecret(pk, Network.Main);
var legacy_address = bitcoinPrivateKey.GetAddress(ScriptPubKeyType.Legacy);
Console.WriteLine("Legacy Address :" + 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("P2SH-Segwit Address :" + p2shsegwit_address);
Console.WriteLine("Bech32 Address :" + nativesegwit_address);










