Saturday, 24 December 2016

Difference between Static variable and Static read only variable in C#

In this post we are going to see what is the difference between Static Variable and Static read only variable in C#, For this to check we are taking a singleton class which can be very useful to discuss.

For Singleton we need a static variable for maintain the singleton instance. Let we see two classes one with static variable another one with static readonly



Static : Static constructor, Normal constructor, properties etc






Static Read Only : Static constructor, other places we can see the Error if user assign









Static :
**********************
In Static variable we can assign the value in static constructor, normal constructor, inside properties etc



    public class PlanetarySystem
    {
        private static PlanetarySystem _instance;

        static PlanetarySystem()
        {
            _instance = new PlanetarySystem();
        }

        public PlanetarySystem(){           
        }

        public static PlanetarySystem Instance
        {
            get
            {
                _instance = new PlanetarySystem();
                return _instance;
            }
        }

        public string PlanetName { set; get; }

        public int Rotation { set; get; }

        public void Rotate()
        {
            Console.WriteLine("Rotating ... ");
        }
      

    }




Static Read only:
*********************
In static readonly we can assign the value only inside of the static constructor, other ways are not allowed.

    public class PlanetarySystem
    {
        private static readonly PlanetarySystem _instance;

        static PlanetarySystem()
        {
            _instance = new PlanetarySystem();
        }

        public PlanetarySystem(){                   
        }

        public static PlanetarySystem Instance
        {
            get
            {             
                return _instance;
            }
        }

        public string PlanetName { set; get; }

        public int Rotation { set; get; }

        public void Rotate()
        {
            Console.WriteLine("Rotating ... ");
        }
      
    }




From this post you can see what is the difference between static and static read only variable

Friday, 23 December 2016

New Cool Features present in Visual Studio 2017 RC

Today we are going to see what are the new features present in the visual studio 2017 RC version, its a great version of visual studio, more support for intellisense to support developers. Let we see one by one.


1. Goto
2. Advanced Intellisense Window
3. Advanced Reference Window 
4. Predictive intellisense
5. Run execution Here
6. Performance data on Debug
7. Xaml Edit and Continue
8. Live Test Run
9. Xaml Predicitive Intellisense
10. Xaml Rename
11. Xaml Namespace
12. References information above members
13. Open Folder option in Editor
14. More Faster build and launch



Goto :

Click the Edit menu and select the Goto option, you can find many options like Type, All, Members, symbols, classes etc ..
This will launch the Window for Goto the specific code place.









Advance Intellisense Window:

In newer version we can find the intellisense window is separated or group against, classes, members, propeties etc



































Predictive intellisense

In newer version when user types the input for a method, the values predictive to the equal to the actual one based on type.



Advance References Window

In newer version The reference Window are showing the results with grouping of places against files.








Run Execution here

In newer version when user breakpoints the code, then they can see the each and every line after the break point have a run buttton on left side of each line of code, that means if they click that button then the code executes and stops at that position, 









Performance options

In newer version performance data are shown in the debug mode like number of seconds to took reach  the certain place.






Xaml Edit and continue

In newer version we can able to edit the value of xaml and see the changes in the UI. using visual tree helper.





























Live Test Run

In newer version we can run a Live test run , by click on the Test menu--> then click on the Live unit Test

This will run a Live test run and shows the result in  the live windows, even we can in the left of each member an information regarding whether this member have any test cases or not











































Xaml Predicitive Intellisense

In newer version Xaml have a Predicitive intellisense, with more faster and quicker, just with in the shorter type we can get the value for example For ColumnSpan  we can type  CS, it will bring the value









Xaml Rename

In newer version we can select any one xaml tag candidate and rename it, it will change the dependency also in xaml
















Xaml Namespace

In newer version Xaml Namspace issues are showed in intellisense, if you miss the namespace then intellisense will suggest you solution






















Reference information of members

In newer version we can see information on each members like number of references for each members











Open Folder option

In newer version we can have new option called Open Folder option to work with project , in newer Angular 2 are all having this kind of options



Faster Build and launch 

The newer version is faster in launch and build , when compare to previous versions.








From this you can learn some new cool features present in the Visual studio 2017 RC.