Showing posts with label Visual Studio. Show all posts
Showing posts with label Visual Studio. Show all posts

Friday, October 31, 2014

Sitecore: - What happens if your debugger is not attached to Visual studio

Sometimes while working our system not able to attach visual studio, please follow the below steps to fix it.

1) Check the .pdb is existing in the bin folder (.DB is the referent of.dll and creating parallel to the .dll)
2) Check any issues in the visual studio, restart it once
3) Reset the skip settings of visual studio
Devenv /resetskippackages

Monday, November 25, 2013

Generic functionality and sample program.

Generics refers to a technique of writing code for a class without specifying the data type that the class works with.

First we should now why we required generic

Earlier in C# 1.1 we have object programming and there we  can create object  and in case of typesafe and performace we were creating another classes.

In generic basically we are defining the datatype.

Let say.
  class Generic
    {
        T[] itemsType;
        public static string Name ="test";
    }
}
Calling the generic function
   String nameValue = "";
            nameValue = Generic<string>.Name;

Simple generic program:-
Create a class below
class Address {

        public int SrNo { get; set; }
        public string Name { get; set; }

        public Address(int srNoInput, string NameInput)
        {
            this.SrNo = srNoInput;
            this.Name = NameInput;
        }

    }

Use this class through generic functionality

       List<Address> Addresslist = new List<Address>();

            Addresslist.Add( new Address(1,"Fist"));
            Addresslist.Add( new Address(2,"Second"));
            Addresslist.Add( new Address(3,"Third"));

            foreach( Address Add in Addresslist)
            {

                Console.WriteLine("Address Number:- "  +  Add.SrNo);
                Console.WriteLine("Address Name r:- " + Add.Name);


            }