Archive

Archive for the ‘Visual Studio 2008’ Category

This server version is not supported. Only servers up to Microsoft SQL Server 2005 are supported –Visual Studio 2005

May 25, 2009 shahharsh Leave a comment

To resolve the error , you can download the update- Microsoft Visual Studio 2005 Service Pack 1 Update for Microsoft SQL Server 2008 Support

This update enables developers to use Microsoft Visual Studio 2005 Service Pack 1 with Microsoft SQL Server 2008. For more information please visit the download link.

Download link:

http://www.microsoft.com/downloads/details.aspx?FamilyID=e1109aef-1aa2-408d-aa0f-9df094f993bf&displaylang=en

Happy Learning !!!

Introduction to Struct in C#

March 23, 2009 shahharsh Leave a comment

This article provides an introduction to Structs in C#. It gives a basic understanding on the following

    • What is struct?
    • When to use Struct?
    • Struct Examples
  1. Struct is a value type.
  2. It is used to encapsulate small related group of variables.
  3. It can also contain the following
    • Constructor
    • Fields
    • Constants
    • Methods
    • Properties
    • Indexers
    • Operators
    • Events
    • Nested types

Note: If you are planning to use all the above listed members then it is better to use a class. The reason is struct are mainly used for light weight objects.

4. Struct can implement interface but cannot inherit from another struct. Thus struct members cannot be declared as protected.

5. Except constants and static fields, we cannot initialize fields within the struct declaration.

6. We can declare constructors with parameters for structs.

7. All structs are inherited from System.ValueType (which inherits from System.Object).

8. Struct can be used as nullable type and can also be assigned a null value.

9. If you want to initialize the struct members then the only way is to declare a parameterized constructor and in that constructor initialize the struc members (Refer to the example 2 in this article)

How Structs are defined?

The Structs are defined by using struct keyword.

Example

Public struct TableDimension

{

//Declare Fields, constants,properties, methods ….here

}

Example 1: Creating a Struct

struct TableDimensions


            public int tableHeight;

public int tableLength;

}

Using struct:

private void btnStruct1_Click(object sender, EventArgs e)

{

          //Declare and Initialize the struct objects
          TableDimensions tbDim;

tbDim.tableHeight = 10;

tbDim.tableLength = 20;

        //Displaying value from the struct objects

         MessageBox.Show("Table Length " + tbDim.tableLength.ToString()); 

Note:

1. In the above example1 we can see that the struct object is created without using the new operator.

2. This means that there will be no constructor call for struct if we create an object without using the new operator.

3. In this case the struct fields will remain unassigned and cannot be used until they are assigned values. If you comment the fields assignment in the above example and try to compile the code then it will result in error.

Example 2: Creating a Parameterized constructor for struct and initialized the struct members 

//Declaring a struct

struct TableDimensions


public int tableHeight; 
public int tableLength;

public TableDimensions(int height1,int length1)

{
tableHeight = height1;

tableLength = length1;

}

}

private void btnStruct1_Click(object sender, EventArgs e)

{

TableDimensions tbDim1 = new TableDimensions(30, 60);

MessageBox.Show("Table Length " + tbDim1.tableLength.ToString()

);

}

Notes:

  1. In the above example we have created a struct with the parameterized constructor to initialize the structure fields

  2. When we create an object of a struct using new operator, the new operator doesn’t acts like a class but it simply calls the declared constructor and initialize all the fields.

  3. Parameterized constructors are the only way in structs to initialize the struct members.

Hope you liked the introduction to struct in C#…your suggestions are welcome.

Happy Learning…by Harsh Shah

Visual Studio 2008 Overview

April 21, 2008 shahharsh Leave a comment

Visual Studio 2008 Overview 

By this time we all are aware about the new product launch from Microsoft for the developer community. Yes, it’s Visual Studio 2008 and SQL Server 2008. Today we are going to have a quick overview on the new feature set of the product- Visual Studio 2008. 
  

Microsoft vision of smart client application is achieved by enabling developers to create connected applications rapidly and with the highest quality and the rich user experiences. Microsoft Visual Studio 2008 delivers on the Microsoft’s vision of smart client applications. 
  

Visual Studio 2008 enables organizations of every size to rapidly create more secure, manageable, and reliable applications that take advantage of Windows Vista™ and the 2007 Office system. 

  

Visual Studio 2008 delivers key advances for developers in three primary pillars: 

  

·      Rapid application development  

·      Effective team collaboration  

·      Break through user experiences 

  

Developers can take advantage of advanced development tools, debugging features, database functionality, and innovative features introduced in Visual Studio 2008 to create innovative products. 

  

Visual Studio 2008 includes enhancements such as  

  

·      Visual designers for faster development with the .NET Framework 3.5,  

·      Improvements to Web development tools  

·      Language enhancements that speed development with all types of data.  

·      Create AJAX enabled web applications  

  

Microsoft Visual Studio 2008 enables organizations to take full advantage of the .NET Framework 3.5 and the 2007 Microsoft Office system to create client, Office, Web, and mobile applications that deliver high-quality, rich user experiences that add to effective business processes and decision making. 

 

What’s New in Visual C# 

  

There are several new features introduced in C# 3.0.  

  

Visual C# IDE Features 

  

Multi-targeting 

  

with Multi-targeting you can specify the .Net Framework for your project i.e. you can write / develop programs for .NET 2.0/3.0/3.5 from the same IDE. 

  

New Project Types and Templates 

  

·      Several new project templates are provided for  

·      Windows Presentation Foundation,  

·      Windows Communication Foundation  &  

·      Web projects   

  

IntelliSense support for C# 3.0 

  

The Visual C# code editor provides statement completion and Quick Info to support the following new language constructs in C# 3.0: 

 

·         Implicitly Typed Local Variables 

·         Query Expressions 

·         Extension Methods 

·         Object/Collection Initializers 

·         Anonymous Types 

·         Lambda Expressions 

·         Partial Methods 

 

Refactoring support for C# 3.0 

 

The refactoring features, Rename, Signature Change, Extract Method, and Promote Local have been updated to support the following new language constructs: 

 

·         Query Expressions 

·         Extension Methods  

·         Lambda Expressions 

 

Code Formatting 

 

The code editor supports formatting options for several new C# 3.0 language constructs including query expressions. 

 

 

Happy Learning !!! 

Harsh Shah (Sr. Consultant)

Categories: Visual Studio 2008