Alternatives
Members may post updates or alternatives to this current article in order to show different
approaches or add new features.
You can limit the scope of 'p' inside your function:private void Whatever() { DoStuffHere(); // 'p' is not in scope. { var p = this.StatusProgressBar; // 'p' is in scope. p.IsIndeterminate = false; p.[etc] } // 'p' is not in...
27 May 2011Omar Al Zabir 4 alternatives
VB has a With keyword that you can use to save typing same variables name over and over again. Here's a similar workaround for C#
15 Feb 2012johannesnestler
It's not realy an alternate - but I think it should be mentioned. Most time you have this kind of code during initialization. So why not use this:StatusProgressBar spb = new StatusProgressBar() { IsIndeterminate = false, Visibility = Visibility.Visible, ...
16 Feb 2012Brightmoore Solutions LLC
This class wraps any Type to allow it to be used only within the context of a using statement. It allows for implicit casting to T so it is pretty transpartent.Example usage: using(string scoped_string = Scope("Hello, World!")) { ...
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..