Click here to Skip to main content
11,648,094 members (60,627 online)
Click here to Skip to main content

Tagged as

C# equivalent of VB's With keyword

, 27 May 2011 CPOL 6.3K 4
Rate this:
Please Sign up or sign in to vote.
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;
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

CaldasGSM
Software Developer
Portugal Portugal
From the age of 15 I started programing in QBasic at home after several jobs I realized that what I wanted was to work with computers, so I joined a IT company, originally as a web designer, but thanks to my self learning abilities I made my way into the programmers team. Today I know VB, VBScript, Javascript, HTML, SQL , C# and C++... even if I never went to college.. Smile | :)

You may also be interested in...

Comments and Discussions

 
QuestionOnly works for reference types! Pin
Andreas Gieriet20-Mar-13 4:37
memberAndreas Gieriet20-Mar-13 4:37 
GeneralSorry for my bad english. I'm trying to use this tip and I g... Pin
Member 296959616-Feb-12 11:42
memberMember 296959616-Feb-12 11:42 
GeneralRe: the "var" keyword only exists in c# 3.0.. you are probably u... Pin
CaldasGSM16-Feb-12 22:52
memberCaldasGSM16-Feb-12 22:52 
GeneralReason for my vote of 5 Simple and efficient Pin
John Brett6-Jan-12 4:49
memberJohn Brett6-Jan-12 4:49 
GeneralReason for my vote of 5 I think it is the best way to do it.... Pin
Philippe Mori31-May-11 12:45
memberPhilippe Mori31-May-11 12:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150804.4 | Last Updated 27 May 2011
Article Copyright 2011 by CaldasGSM
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid