'SignalR Example in VB
I am trying to convert the following C# code to VB:
private readonly StockTicker _stockTicker;
public StockTickerHub() : this(StockTicker.Instance) { }
public StockTickerHub(StockTicker stockTicker)
{
_stockTicker = stockTicker;
}
public IEnumerable<Stock> GetAllStocks()
{
return _stockTicker.GetAllStocks();
}
I pretty much got it figure out, except for this one line:
public StockTickerHub() : this(StockTicker.Instance) { }
Does anyone have an idea how to convert this line to VB?
Solution 1:[1]
I believe I figured it out. The above C# code, in VB, looks like this:
Private ReadOnly _stockTicker As StockTicker
Public Sub New()
Me.New(StockTicker.Instance)
End Sub
Public Sub New(ByVal stockTicker As StockTicker)
_stockTicker = stockTicker
End Sub
Public Function GetAllStocks() As IEnumerable(Of Stock)
Return _stockTicker.GetAllStocks()
End Function
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | brasco18 |
