Change switch to if-else
MODIFY
WalletWasabi.Gui/Config.cs
WalletWasabi.Gui/Config.cs
@@ -258,39 +258,40 @@ namespace WalletWasabi.Gui
public void SetP2PEndpoint(EndPoint endPoint)
{
- switch (Network.Name)
+ if (Network == Network.Main)
{
- case nameof(Network.Main):
MainNetBitcoinP2pEndPoint = endPoint;
- break;
-
- case nameof(Network.TestNet):
+ }
+ else if (Network == Network.TestNet)
+ {
TestNetBitcoinP2pEndPoint = endPoint;
- break;
-
- case nameof(Network.RegTest):
+ }
+ else if (Network == Network.RegTest)
+ {
RegTestBitcoinP2pEndPoint = endPoint;
- break;
-
- default:
+ }
+ else
+ {
throw new NotSupportedException("Unsupported network");
}
}
public EndPoint GetP2PEndpoint()
{
- switch (Network.Name)
+ if (Network == Network.Main)
{
- case nameof(Network.Main):
return MainNetBitcoinP2pEndPoint;
-
- case nameof(Network.TestNet):
+ }
+ else if (Network == Network.TestNet)
+ {
return TestNetBitcoinP2pEndPoint;
-
- case nameof(Network.RegTest):
+ }
+ else if (Network == Network.RegTest)
+ {
return RegTestBitcoinP2pEndPoint;
-
- default:
+ }
+ else
+ {
throw new NotSupportedException("Unsupported network");
}
}

Change switch to if-else