title: Sharepoint controls and webparts C# descriptions
body: <p>I am learning SharePoint with web parts and I am trying to figure out this sample code and what I does.
  Here is the sample</p>
  
  <pre><code>using System;
  using System.Runtime.InteropServices;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using System.Web.UI.WebControls.WebParts;
  using System.Xml.Serialization;
  using Microsoft.SharePoint;
  using Microsoft.SharePoint.WebControls;
  using Microsoft.SharePoint.WebPartPages;
  
  namespace SampleWebpart1
  
    {
      [Guid("cf5f3fd5-1776-4c47-9587-4f6fe4f3d645")]
  
      public class SampleWebpart1 : Microsoft.SharePoint.WebPartPages.WebPart            
        {
  
            public SampleWebpart1() { }
  
            protected override void CreateChildControls()
              {
                base.CreateChildControls();
                SharePointCalendar calendar = new SharePointCalendar();
                Controls.Add(calendar);
              }
         }
  
      public class SharePointCalendar : Control
  
       {
         private SPCalendarView _view;
         /// Create the SharePoint calendar. Uses the SharePoint SPCalendarView object.
         protected override void CreateChildControls()
          {
            base.CreateChildControls();
            _view = new SPCalendarView();
            _view.EnableViewState = true;
            _view.Width = Unit.Percentage(100);
            _view.DataSource = GetCalendarItems();
            DataBind();
            Controls.Add(_view);
          }
  
        private SPCalendarItemCollection GetCalendarItems()
           {
  
             // Create a new collection for the calendar items
            // This is an item with a start and end date.
             SPCalendarItemCollection items = new SPCalendarItemCollection();
           // Add the first dummy item
             SPCalendarItem item = new SPCalendarItem();
             item.StartDate = DateTime.Now;
             item.EndDate = DateTime.Now.AddHours(1);
             item.hasEndDate = true;
             item.Title = "First calendar item";
             item.DisplayFormUrl = "/News";
             item.Location = "USA";
             item.Description = "This is the first test item in the calendar rollup";
             item.IsAllDayEvent = false;
             item.IsRecurrence = false;
             item.CalendarType = Convert.ToInt32(SPCalendarType.Gregorian);
             items.Add(item);
           // Add the second item. This is an all day event.
          SPCalendarItem item2 = new SPCalendarItem();
          item2.StartDate = DateTime.Now.AddDays(-1);
          item.hasEndDate = true;
          item2.Title = "Second calendar item";
          item2.DisplayFormUrl = "/News";
          item2.Location = "India";
          item2.Description = "This is the second test item in the calendar rollup";
          item2.IsAllDayEvent = true;
          item2.IsRecurrence = false;
          item2.CalendarType = Convert.ToInt32(SPCalendarType.Gregorian);
          items.Add(item2);
         // return the collection
          return items;
         }
  
        }
  
       } 
  </code></pre>
  
  <p>So this is what I am working at My first question is what is this
  [Guid("cf5f3fd5-1776-4c47-9587-4f6fe4f3d645")] mean or do. I have seen something like it in XNA but that was for content processing.</p>
  
  <p>What does the : mean in this line public class SharePointCalendar : Control
  Is that saying that the class sharpointcalendar extends controls?</p>
  
  <p>What does all this do? and why is there a _ before view?</p>
  
  <pre><code>      _view = new SPCalendarView();
        _view.EnableViewState = true;
        _view.Width = Unit.Percentage(100);
        _view.DataSource = GetCalendarItems();
  </code></pre>
  
  <p>Thanks for any help with this:)</p>