Nbitcoin's BitcoinPubKeyAddress not recognizing native segwit addresses I'm trying to build a transaction using Nbitcoin. When I run this line there is an error parsing the address. It runs fine with segwit addresses starting with a 1, but not native segwit.
Using System;
Using System.Text;
Using NBitcoin;

static void Main(string[] args) {

    var wallet = new BitcoinPubKeyAddress(&quot;bc1q....&quot;, Network.Main); //throws error
}

Error: System.FormatException: 'Invalid base58 data'
Is there a way to use native segwit with Nbitcoin? Thanks
It runs fine with segwit addresses starting with a 1, but not native segwit.

Prefix 1 is used by legacy addresses. You can check the other prefixes used here: https://en.bitcoin.it/wiki/List_of_address_prefixes

Is there a way to use native segwit with Nbitcoin?

Replace BitcoinPubKeyAddress with BitcoinWitPubKeyAddress in your code for using native segwit addresses