Conversion de code C# en VB
Bonjour,
je voudrais une confirmation (ou correction) pour ces 2 traductions :
Code:
1 2 3 4 5 6
|
IEnumerator<IXLCell> IEnumerable<IXLCell>.GetEnumerator()
{
foreach (XLCell cell in this)
yield return cell;
} |
devient
Code:
1 2 3 4 5 6 7
|
Private Function IEnumerable_GetEnumerator() As IEnumerator(Of IXLCell) Implements IEnumerable(Of IXLCell).GetEnumerator
For Each cell As XLCell In Me
'yield Return cell
Return cell
Next
End Function |
mon problème est bien sûr YIELD qui n'existe pas en VB donc est-ce bon ou faut-il ajouter autre chose ?
Code:
1 2 3 4 5 6 7 8 9
|
public IXLRanges RangesUsed
{
get
{
var retVal = new XLRanges {AsRange()};
return retVal;
}
} |
devient
Code:
1 2 3 4 5 6 7
|
Public ReadOnly Property RangesUsed() As IXLRanges
Get
Dim retVal = New XLRanges() From {AsRange()}
Return retVal
End Get
End Property |
là mon problème est qu'en Visual studio 2008 le message
Citation:
Fin d'instruction attendue pour "From {AsRange()}"
Merci d'avance à ceux qui peuvent m'aider.
Cdt