VBA to C# with statement<>
This question already has an answer here:
- With block equivalent in C#? 15 answers
As HighCore said, there's no C# equivalent to VB's With block. Here's the equivalent C# code:
myRow = ProductRangeA.Rows.Count; myValue = ProductRangeA.Value; myRow = ProductRangeB.Columns.Count; myValue = ProductRangeB.Value;
Since you can't avoid typing ProductRangeA and ProductRangeB twice each, you can reduce typing by using shorter variable names. That can make the code more difficult to understand, of course.