Differences between structs and classes
1. structs are value types and classes are reference types.
2. structs created in stack, classes are allocated in the heap.
3. For instantiation classes need new keyword, but structs don't need.
4. classes support inheritance but strcuts don't.
5. classes can have explicit constructors without parameters. but structs need parameters for explicit constructors.
6. No initialized fields in structs. but classes can have initializers.
ex: class A
{
int a=10; //ok
}
struct A
{
int a=10; //error
}
7. When passing a class to a method, it is passed by reference. When passing a struct to a method, it's passed by value instead of as a reference.
8. You will always be dealing with reference to an object ( instance ) of a class. But you will not be dealing with references to an instance of a struct ( but dealing directly with them ).
9. Classes permits to declare a destructor. But struct doesn't.
10. It is not mandatory to initialize all Fields inside the constructor of a class.
But all the Fields of a struct must be fully initialized inside the constructor.
Sql Server 2005 - Server level Roles
1. bulkadminMembers of the bulkadmin fixed server role can run the BULK INSERT statement.
2.dbcreatorMembers of the dbcreator fixed server role can create databases, and can alter and restore their own databases.
3.diskadminThe diskadmin fixed server role is used for managing disk files.
4.processadminMembers of the processadmin fixed server role can terminate processes that are running in an instance of SQL Server.
5.securityadminMembers of the securityadmin fixed server role manage logins and their properties. They can GRANT, DENY, and REVOKE server-level permissions. They can also GRANT, DENY, and REVOKE database-level permissions. Additionally, they can reset passwords for SQL Server logins.
6.serveradminMembers of the serveradmin fixed server role can change server-wide configuration options and shut down the server.
7.setupadminMembers of the setupadmin fixed server role can add and remove linked servers, and also execute some system stored procedures.
8.sysadminMembers of the sysadmin fixed server role can perform any activity in the server. By default, all members of the Windows BUILTIN\Administrators group, the local administrator's group, are members of the sysadmin fixed server role.
Value Types in .NET 2.0
value type variables contain data directly rather than containing a reference to data stored in memory.
Instanses of value types are stored in the
stack in memory.
These value types are sub divided into three.
1. Built-In types
2. User-Defined types
3. Enumerations
Built-in TypesThese are the base types in .NET, with which other types are built.
Ex:
System.SByte VB-SByte(VB is not case sensitive)
C#-sbyte (C# is case sensitive)
System.Single VB-Single
C#-float
BEST PRACTICES:Try to use
32-bit integer type(Int32/UInt32) for best runtime performance.
Try to use
Double for floating point operations.
What do you think? Are value types, objects? Yes. they function as objects.
Ex: int a;
a.ToString(); //that means you call a method of int a.