65.9K
CodeProject is changing. Read more.
Home

C# equivalent of VB's With keyword

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.92/5 (12 votes)

May 26, 2011

CPOL
viewsIcon

17980

You are introducing a variable “p” in the local scope of the whole function :snot really.. you know you can use brackets anywhere inside the code to define subscopes, don't you:{var p = this.StatusProgressBar;p.IsIndeterminate = false;p.Visibility = Visibility.Visible;p.Minimum =...

You are introducing a variable “p” in the local scope of the whole function :s not really.. you know you can use brackets anywhere inside the code to define subscopes, don't you:
{
var p = this.StatusProgressBar;
p.IsIndeterminate = false;
p.Visibility = Visibility.Visible;
p.Minimum = 0;
p.Maximum = 100;
p.Value = percentage;
}