Documente Academic
Documente Profesional
Documente Cultură
This makes clustered indexes great for retrieving lots of data based on range based queries
since all the data is located next to each other.
Since the clustered index is actually related to how the data is stored, there is only one of
them possible per table (although you can cheat to simulate multiple clustered indexes).
A non-clustered index is different in that you can have many of them and they then point at
the data in the clustered index. You could have e.g. a non-clustered index at the back of a
phone book which is keyed on (town, address)
Imagine if you had to search through the phone book for all the people who live in 'London' -
with only the clustered index you would have to search every single item in the phone book
since the key on the clustered index is on (lastname, firstname) and as a result the people
living in London are scattered randomly throughout the index.
If you have a non-clustered index on (town) then these queries can be performed much more
quickly.
An index is used to speed up the performance of queries. It does this by reducing the number
of database data pages that have to be visited/scanned.
In SQL Server, a clustered index determines the physical order of data in a table. There can
be only one clustered index per table (the clustered index IS the table). All other indexes on a
table are termed non-clustered.
SQL injection is a code injection technique that might destroy your database.
SQL injection is the placement of malicious code in SQL statements, via web page input.
The C-Sharp(C#) is the most powerful and famous programming language for application
development. This language is now widely used in different enterprise level application
development. This article describes some advance questions and answers in C#. These C#
questions will be very helpful for experience persons or experience developers. Hope it will
help you to build successful carrier.
For example consider the bellow class. If we call the old method it will through error
message.
AttributeUsage
Conditional
Obsolete
This marks a program that some entity should not be used.
What is Reflection?
Reflection is a process by which a computer program can monitor and modify its own structure
and behavior. It is a way to explore the structure of assemblies at run time (classes, resources,
methods). Reflection is the capability to find out the information about objects, metadata, and
application details (assemblies) at run-time. We need to include System.Reflection namespace
to perform reflections in C#. For example consider the following C# codes, which will returns
some meta information’s.
dynamic x = "c#";
x++;
It will not provide error at compile time but will provide error at run time.
What is serialization?
When we want to transport an object through network then we need to convert the object into
a stream of bytes. Serialization is a process to convert a complex objects into stream of bytes
for storage (database, file, cache, etc) or transfer. Its main purpose is to save the state of an
object.
De-serialization is the reverse process of creating an object from a stream of bytes to their
original form.
Binary Serialization
In this process all the public, private, read only members are serialized and convert into
stream of bytes. This is used when we want a complete conversion of our objects.
SOAP Serialization
In this process only public members are converted into SOAP format. This is used in
web services.
XML Serialization
In this process only public members are converted into XML. This is a custom
serialization. Required namespaces: System.Xml, System.Xml.Serialization.
Why serialization and de-serialization?
For example consider, we have a very complex object and we need XML format to show it on
HTML page. Then we can create a XML file in the disk, writes all the necessary data on the
XML file, and use it for the HTML page. But this is not good approach for large number of
users. Extra space is required; anyone can see the XML file which creates security issue. We
can overcome it by using XML serialization.
What is Generics?
Generics are the most powerful features introduced in C# 2.0. It is a type-safe data structure
that allows us to write codes that works for any data types.
The Microsoft .NET framework provides specialized classes for data storage and retrieval.
Collections are one of them. Collection is a data structure that holds data in different ways.
Collections are two types. One is standard collections, which is found under
System.Collections namespace and another one is generic collections, which is found under
System.Collections.Generic namespace.The generic collections are more flexible and
preferable to work with data.
Some commonly used collections under System.Collections namespace are given bellow:
ArrayList
SortedList
Hashtable
Stack
Queue
BitArray
In the CLR, unsafe code is referred to as unverifiable code. In C#, the unsafe code is not
necessarily dangerous. The CLR does not verify its safety. The CLR will only execute the
unsafe code if it is within a fully trusted assembly. If we use unsafe code, it is our own
responsibility to ensure that the code does not introduce security risks or pointer errors.
In Visual Studio IDE at first we need to enable use of unsafe code in the project properties.
The steps are given bellow:
What is Pointer?
Pointer is a variable that stores the memory address of another variable. Pointers in C# have
the same capabilities as in C or C++. Some examples are given bellow: