1.
What is CTS in C#?
In
Microsoft's .NET
Framework, the Common Type System (CTS) is a standard that specifies how Type definitions and specific values of Types
are represented in computer memory. It is intended to allow programs written in
different programming languages to easily share information. As used in programming
languages, a Type can be described as a definition of a set
of values (for example, "all integers between 0 and 10"), and the
allowable operations on those values (for example, addition and subtraction).
Function Of CTS:
To
establish a framework that helps enable cross-language integration, type
safety, and high performance code execution.
To
provide an object-oriented model
that supports the complete implementation of many programming languages.
To define
rules that languages must follow, which helps ensure that objects written in
different languages can interact with each other.
The CTS
also defines the rules that ensures that the data types of objects written in
various languages are able to interact with each other.
The CTS
also specifies the rules for type visibility and access to the members of a
type, i.e. the CTS establishes the rules by which assemblies form scope for a
type, and the Common Language Runtime enforces the visibility rules.
The CTS
defines the rules governing type inheritance, virtual
methods and object lifetime.
Languages
supported by .NET can implement all or some common data types…
4.
Paging is possible in repeater control?
The Repeater
control is used to display a repeated list of items that are bound to the
control. The Repeater control may be bound to a database table, an XML file, or
another list of items. Repeater control
lacks paging and sorting of data like other data bound controls such as
Datagrid, GridView, DetailsView and FormView. But we can add this feature to repeater control.
6.
How we make dynamic table in C#?
In ASP.Net 2.0 there are number of controls to
display the data retrieved from the database in tabular form using Grid View
Control, list view Control, Repeater. But in some cases when there is no option
to custom these default controls. At that time a questions arises – how to generate dynamic
tables? How to display
the data according to requirement?
You can use the Literal Control to display the html tagged
string generated by using VB/C# code in ASP.Net 2.0.
To generate the table using string variables
you can use the following C#
code:
-
- string dynTable = "";
-
-
- dynTable = "<table cellspacing=\"0\" cellpadding=\"2\" border=\"1\">";
-
-
- for (int tRows = 0; tRows < 5; tRows++)
- {
-
- dynTable += "<tr>";
-
-
- for (int tCols = 0; tCols < 4; tCols++)
- {
-
- dynTable += "<td>";
- dynTable += "Row: " + (tRows + 1) + " Col: " + (tCols + 1);
-
-
- dynTable += "</td>";
- }
-
-
- dynTable += "</tr>";
- }
-
-
- dynTable += "</table>";
-
- Literal1.Text = dynTable;
Above C# code will build a string having table
tag, tr as table row, td as table data/column. To display the data retrieved
from database you can set the tRows < [No. of DataRows Retrieved] and tCols
< [No. of DataColmns].
7.
Table value function in Sql Server?
User-defined functions that return a table data type can be powerful alternatives
to views. These functions are referred to as table-valued functions. A
table-valued user-defined function can be used where table or view expressions
are allowed in Transact-SQL queries. While views are limited to a single SELECT
statement, user-defined functions can contain additional statements that allow
more powerful logic than is possible in views.
A table-valued user-defined function can also
replace stored procedures that return a single result set. The table returned
by a user-defined function can be referenced in the FROM clause of a
Transact-SQL statement, but stored procedures that return result sets cannot.
8.
Event log in C#?
Event
logging provides a standard, centralized way for your applications to record
important software and hardware events. Windows supplies a standard user
interface for viewing the logs, the Event Viewer. By using the common
language's run-timeEventLog component,
you can connect to existing event logs easily, on both local and remote
computers, and write entries to these logs. You can also read entries from
existing logs and create your own custom event logs. In its simplest form,
writing to an event log involves only a few steps to create a sample
application. To do this, follow these steps:
1.
Open
Visual Studio C#.
2.
Create a
new Console application in Visual C#. The Console application creates a public
class and an empty Main method
for you.
3.
Verify
that the project references at least the System.dll file.
4.
Use the using directive on the System and System.Diagnostics namespaces so that you do not have to
qualify declarations from these namespaces later in your code. You must use
these statements before any other declarations.
5. using System;
6. using System.Diagnostics;
7.
To write
to an event log, you must have several pieces of information: Your message, the
name of the log you to which you want to write (which will be created if it
does not already exist), and a string that represents the source of the event.
You can register a particular source with only a single event log; if you want
to write messages to more than one log, you must define multiple sources.
8. string sSource;
9. string sLog;
10. string sEvent;
11.
12. sSource = "dotNET Sample App";
13. sLog = "Application";
14. sEvent = "Sample Event";
15.
Use two
static methods of the EventLog class to check whether your source
exists, and then, if the source does not exist, to create this source that is
associated with a particular event log. If the log name that you specify does
not exist, the name is created automatically when you write your first entry to
the log. By default, if you do not supply a log name to the CreateEventSource method, the log file is named
"Application Log."
16. if (!EventLog.SourceExists(sSource))
17. EventLog.CreateEventSource(sSource,sLog);
18.
To write
a message to an event log, you can use the EventLog.WriteEntry static method. This method has several
different overloaded versions. The following sample code shows the simplest
method, which takes a source string and your message, and one of the more
complex methods, which supports specifying the event ID and event type:
19. EventLog.WriteEntry(sSource,sEvent);
20. EventLog.WriteEntry(sSource, sEvent, EventLogEntryType.Warning, 234);
21.
Save your
application. Run your application, and then check the Application log in the
Event Viewer to see your new events.
Complete code listing
using System;
using System.Diagnostics;
namespace WriteToAnEventLog_csharp
{
/// Summary description for Class1.
class Class1
{
static void Main(string[] args)
{
string sSource;
string sLog;
string sEvent;
sSource = "dotNET Sample App";
sLog = "Application";
sEvent = "Sample Event";
if (!EventLog.SourceExists(sSource))
EventLog.CreateEventSource(sSource,sLog);
EventLog.WriteEntry(sSource,sEvent);
EventLog.WriteEntry(sSource, sEvent,
EventLogEntryType.Warning, 234);
}
}}
9.
DML event possible in function?
No.
11.
How we get emp 3rd Max salary?
Select sal from emp a
where 3=(select
count(distinct(sal)) from emp b
where a.sal<=b.sal)
4.
What is Cascading in Sql Server?
Microsoft SQL Server provides declarative
referential integrity (DRI) which allows you to define data integrity
restrictions for a table as well as relationships between tables, both of which
are enforced by SQL Server automatically at the system level.
SQL Server conforms to ANSI Entry SQL with
regard to referential integrity between PrimaryKey and ForeignKey columns which
requires the inserting, updating, and deleting of data in related tables to be
restricted to values that preserve the integrity.
ANSI Intermediate SQL adds 'referential
actions,' which describe what should be done to dependent ForeignKey values
when their corresponding PrimaryKey values are updated or deleted. This article
describes how such cascading deletes and updates can be implemented with SQL
Server.
5.
What is indexing in Sql Server?
One of the most important
routes to high performance in a SQL Server database is the index. Indexes speed
up the querying process by providing swift access to rows in the data tables,
similarly to the way a book’s index helps you find information quickly within
that book.
Index Types
In
addition to an index being clustered or nonclustered, it can be configured in
other ways:
·
Composite index: An index that contains more than one column. In both SQL Server 2005
and 2008, you can include up to 16 columns in an index, as long as the index
doesn’t exceed the 900-byte limit. Both clustered and nonclustered indexes can
be composite indexes.
·
Unique Index: An index that ensures the uniqueness of each value in the indexed
column. If the index is a composite, the uniqueness is enforced across the
columns as a whole, not on the individual columns. For example, if you were to
create an index on the FirstName and LastName columns in a table, the names
together must be unique, but the individual names can be duplicated.
A unique index is automatically created when
you define a primary key or unique constraint:
§ Primary key: When you define a primary key
constraint on one or more columns, SQL Server automatically creates a unique,
clustered index if a clustered index does not already exist on the table or
view. However, you can override the default behavior and define a unique,
nonclustered index on the primary key.
§ Unique: When you define a unique
constraint, SQL Server automatically creates a unique, nonclustered index. You
can specify that a unique clustered index be created if a clustered index does
not already exist on the table.
·
Covering index: A type of index that includes all the columns that are needed to
process a particular query. For example, your query might retrieve the FirstName
and LastName columns from a table, based on a value in the ContactID column.
You can create a covering index that includes all three columns.
6.
What is clustered and non clustered index?
Clustered Indexes
A
clustered index stores the actual data rows at the leaf level of the index.
Returning to the example above, that would mean that the entire row of data
associated with the primary key value of 123 would be stored in that leaf node.
An important characteristic of the clustered index is that the indexed values
are sorted in either ascending or descending order. As a result, there can be
only one clustered index on a table or view. In addition, data in a table is
sorted only if a clustered index has been defined on a table.
Nonclustered Indexes
Unlike
a clustered indexed, the leaf nodes of a nonclustered index contain only the
values from the indexed columns and row locators that point to the actual data
rows, rather than contain the data rows themselves. This means that the query
engine must take an additional step in order to locate the actual data.
A row
locator’s structure depends on whether it points to a clustered table or to a
heap. If referencing a clustered table, the row locator points to the clustered
index, using the value from the clustered index to navigate to the correct data
row. If referencing a heap, the row locator points to the actual data row.
Nonclustered
indexes cannot be sorted like clustered indexes; however, you can create more
than one nonclustered index per table or view. SQL Server 2005 supports up to
249 nonclustered indexes, and SQL Server 2008 support up to 999. This certainly
doesn’t mean you should create that many indexes. Indexes can both help and
hinder performance, as I explain later in the article.
In addition to being able to create
multiple nonclustered indexes on a table or view, you can also add included columns to your index. This means that you can
store at the leaf level not only the values from the indexed column, but also
the values from non-indexed columns. This strategy allows you to get around
some of the limitations on indexes. For example, you can include non-indexed
columns in order to exceed the size limit of indexed columns (900 bytes in most
cases).
7.
What is state management in .net?
State
Management is the process by which we maintain session related information and
additional information about the controls and its state. The necessity of state
management arises when multiple users request for the same or different Web
Pages of a Web Site.
Client Side State Management Options
Client
Side State Management involves storing information either on a Web page or on a
Client computer. There are four ways to manage states.
- View State
- Hidden Form Fields
- Cookies
- Query String
View State
In
this method, the ViewState property that is inherited from the base Control
class is used to automatically save the values of the page and of each control
prior to rendering of the page. ViewState is implemented with a hidden form
field called the _VIEWSTATE, which is automatically created in every Web Form
page. When ASP.Net executes a Web page on a Web Server, the values stored in
the ViewState property of the page and controls on it are collected and
formatted into a single encoded string. The encoded string is then assigned to
the Value attribute of the hidden form field _VIEWSTATE and is sent to the
client as a part of the Web page.
Hidden Form
Fields
In
ASP.Net we can use the HTML standard hidden fields in a Web Form to store
page-specific information. A hidden field does not render in a Web browser.
However, we can set the properties of the hidden field. When a page is
submitted to the server, the content of the hidden field is sent in the HTTP
Form collection along with values of other controls.
Cookies
A cookie
is a small data structure used by a Web server to deliver data to a web client.
A cookie contains page specific information that a Web server sends to a client
along with Page output. Cookies are used to keep track of each individual user
who accesses the web page across a HTTP connection.
Query String
The
Query string is a part of the request that appears after the Question mark (?)
character in the URL. A query string provides a simple way to pass information
from one page to another.
Server Side State Management Options
Application
State
ASP.Net
provides application state as a means of storing global application specific
information. The information in the application state is stored in a key value
pair and is used to maintain data consistency between server round trips and
between pages.
Session
State
In
this option session state used to store session specific information for a Web
site. In session state, the scope fo session state is limited to the current
browser session. In case, many users are accessing the same Web application,
each will have a different session state. If a user exits from a Web applicatin
and returns later, it will be a different session state.
Database
Support
Another
option is the database support option. Database support is used in combination
with cookies or session state. The database used is usually a relational
database.
9.
How much type of cookies in .Net?
There are two types of cookies in ASP.NET
Single valued cookies
Example:
request.cookies(”UserName”).value=”myCookies”
Multivalued cookies
Example
request.cookies(”CookiName”)(”UserName”)=”Lucky”
request.cookies(”CookiName”)(”UserID”)=”1234?
10.
What is the best way to move one value to another page?
Sessions.
11.
What is the diff b/w script manager and script manager proxy?
1. You can only have
one script manager per page
2. A server control that makes script resources available to the browser,
including the Microsoft AJAX Library and the functionality that enables
partial-page rendering.
Script manager proxy
1. You can have multiple proxies.
2. A server control that enables nested components to add script and service
references if the page already contains a ScriptManager control.
12. Why
we use script Manager?
Script
manager control is the control that send the scripts to the client. This
control is at the heart of all AJAX related functions. It manages all controls
in your Ajax enabled page. It also ensures that partial page updates happen as
it is expected.
13.
What is diff b/w server.transfer and cross page posting?
1. In ‘Server.Transfer’, the
URL doesn’t change whereas in cross page posting, the form is submitted to a
different page, thereby changing the url.
2. The Server.Transfer method
is a server-based operation whereas cross-page postback is a client-based
transfer.
1.
What is the diff b/w table variable and temporary table?
Table
variables are Transaction neutral. They are variables and thus aren't bound to
a transaction.
Temp tables
behave same as normal tables and are bound by transactions.
A simple example
shows this difference quite nicely:
BEGIN TRAN
declare @var table (id int, data varchar(20) )
create table #temp (id int, data varchar(20) )
insert into @var
select 1, 'data 1' union all
select 2, 'data 2' union all
select 3, 'data 3'
insert into #temp
select 1, 'data 1' union all
select 2, 'data 2' union all
select 3, 'data 3'
select * from #temp
select * from @var
ROLLBACK
select * from @var
if object_id('tempdb..#temp') is null
select '#temp does not exist outside the transaction'
We see that the
table variable still exists and has all it's data unlike the temporary table
that doesn't exists when the transaction rollbacked.
3.
In a transaction we can use temporary table?
The argument is
this: “you can create an InnoDB temporary table and use it only within one
transaction, and then if the slave crashes and restarts, it’ll roll
back the transaction to the beginning.” In other words, in theory if the
temporary table exists only within that one transaction, and if your
transaction accesses only InnoDB tables, it’s safe.
9. In a function we can do any DML operation?
No.
10.
What is the difference between server.tranfer and response.redirect?
Response.Redirect
1. Response.Redirect() will send you to a new
page, update the address bar and add it to the Browser
History. On your browser you can click back.
2. It redirects the request to some plain HTML
pages on our server or to some other web server.
3. It causes additional roundtrips to the server
on each request.
4. It doesn’t preserve Query String and Form
Variables from the original request.
5. It enables to see the new redirected URL where
it is redirected in the browser (and be able
to bookmark it if it’s necessary).
6. Response. Redirect simply sends a message down
to the (HTTP 302) browser.
Server.Transfer
1. Server.Transfer() does not change the address
bar, we cannot hit back.One should use Server.Transfer() when he/she doesn’t want
the user to see where he is going. Sometime on
a "loading" type page.
2. It transfers current page request to another
.aspx page on the same server.
3. It preserves server resources and avoids the
unnecessary roundtrips to the server.
4. It preserves Query String and Form Variables
(optionally).
5. It doesn’t show the real URL where it
redirects the request in the users Web Browser.
6. Server.Transfer happens without the browser
knowing anything, the browser request a page, but the server returns the
content of another.
1.
What is Ajax . How we get ajax through javascript?
Asynchronous JavaScript and XML is
a group of interrelated web
development techniques used on the client-side to create asynchronous web applications. With Ajax, web applications can send
data to, and retrieve data from, a server asynchronously (in the background) without
interfering with the display and behavior of the existing page. Data can be
retrieved using the XMLHttpRequest
object. Despite the name, the use of XML is not
required (JSON is often used instead), and the requests
do not need to be asynchronous.[2]
2.
What is Polymorhism?
- Polymorphism
is one of the primary characteristics (concept) of object-oriented
programming.
- Poly
means many and morph means form. Thus, polymorphism refers to being able
to use many forms of a type without regard to the details.
- Polymorphism
is the characteristic of being able to assign a different meaning
specifically, to allow an entity such as a variable, a function, or an
object to have more than one form.
- Polymorphism
is the ability to process objects differently depending on their data
types.
- Polymorphism
is the ability to redefine methods for derived classes.
Types of Polymorphism
- Compile
time Polymorphism
- Run time
Polymorphism
Compile time
Polymorphism
- Compile
time Polymorphism also known as method overloading
- Method
overloading means having two or more methods with the same name but with
different signatures
Example of Compile time polymorphism
Run time
Polymorphism
- Run time
Polymorphism also known as method overriding
- Method
overriding means having two or more methods with the same name , same
signature but with different implementation
Example of Run time Polymorphism
4.
We can Change Session variable value at runtime?
Generally
the Session Variables tab is used for setting the initial value of session
variables at startup and for values that won't be changing at run time using
actions.
5.
How we can get our table's all datatype and Column name through a Sql Query?
SELECT
t1.column_name, t2.column_name, t1.data_type, t2.data_type
FROM
(select * from serverA.databaseA.information_schema.COLUMNS
WHERE table_name ='tableA') as t1
full outer join
(select * from severB.databaseB.information_schema.COLUMNS
WHERE table_name ='tableA') as t2 ON t1.column_name=t2.column_name;
6.
What is the XML file extension?
.XML File
File
extension: XML
7. What is the diff b/w
grid view and repeater control?
Features
of a GridView:
1.
Displays data as a table
2.
Updateable
3.
Item as row
4.
Control over
§ Alternate item
§ Header
§ Footer
§ Colors, font, borders, etc.
§ Paging
Features of
Repeater:
1.
List format
2.
No default output
3.
More control
4.
More complexity
5.
Item as row
6.
Not updateable
8.
In a string how we get last index value?
created a RegEx solution that doesn't matter
what the property name is, but grabs the last digits and returns an integer
static int GetLastInteger( string name ) {
int value;
if( int.TryParse( name, out value ) ) {
return value;
}
System.Text.RegularExpressions.Regex r =
new System.Text.RegularExpressions.Regex( @"[^0-9](\d+\b)" );
System.Text.RegularExpressions.Match m =
r.Match( name );
string strValue = m.Groups[1].Value;
value = ( int.Parse( strValue ) );
return value;
}
9.
In method overloading return type of a method are same or diff?
Different
1.
What is method overloading and method overriding?
Overloading
Overloading is when you have multiple methods in
the same scope, with the same name but different signatures.
//Overloading
public class test
{
public void getStuff(int id)
{}
public void getStuff(string name)
{}
}
Overriding
Overriding is a principle that allows you to
change the functionality of a method in a child class.
//Overriding
public class test
{
public virtual getStuff(int id)
{
//Get stuff default location
}
}
public class test2 : test
{
public override getStuff(int id)
{
//base.getStuff(id);
//or - Get stuff new location
}
}
2.
What is Datakey in a Gridview?
It generally happens with many
developers that they want some value from the datasource to be
carried in Asp.net Data controls (ListView, GridView etc) but don't want
to show that value in the UI.
One traditional way to do this is to bind that value to a
column or hidden field and set the control visibility as
false.
To get rid of that we can use DataKeys and DataKeyNames property of ListView and GridView.
The DataKeyNames property is to specify the field
names that we want to carry as hidden, from the data source. For more
than one field name we use a comma-separated list of field names.
DataKeyNames = 'Field1, Field2, Field3'
When the DataKeyNames property is set, the ListView control
automatically creates a DataKey object for each item (GridViewRow,
ListViewDataItem) in the control. The DataKey object contains the values
of the field or fields that are specified in the DataKeyNames
property. Then it is added to the control's DataKeys collection. This
provides a convenient way to access different fields of each item.
So, in the code behind the DataKey object give a access to these
hidden values. You just need to pass the key to the DataKeys
collection to get the value out of it.
|
The following example explain all these
things.
Design Page: to specify the column names in the DataKeyNames
property of the ListView or GridView
<asp:ListView ID="lvExample" runat="server"OnItemDataBound="lvExample_ItemDataBound"DataKeyNames="EmployeeId,WorkStatus">
<ItemTemplate>
<!-- the diaplayed
controls here -->
</ItemTemplate>
</asp:ListView >
|
3. What
is viewstate? In hiddenfield which
format it contain?
View State
is one of the most important and useful client
side state management mechanism. It can store the page value at the time of post
back (Sending and Receiving information from Server)
of your page. ASP.NET pages provide the ViewState
property as a built-in structure for
automatically storing values between multiple requests for the same page.
Example:
If you want
to add one variable in View State,
For
Retrieving information from View State
string Test=ViewState["TestVal"];
Sometimes
you may need to typecast ViewState Value to retreive. As I give an Example to
strore and retreive object in view state in the last of this
article.
Which format it contain?
View State
stored the value of page controls as a string which is hashed and encoded in
some hashing and encoding technology. It only contain information about page
and its controls. Its does not have any interaction with server. It stays along
with the page in the Client Browser. View State use Hidden
field to store its information in a encoding
format.
Suppose you
have written a simple code , to store a value of control:
ViewState["Value"] = MyControl.Text;
Now, Run you
application, In Browser, RighClick
> View
Source
, You will get the following section of code
Fig : View state stored in hidden field
Now , look
at the value. looks likes a encrypted string, This is Base64 Encoded string,
this is not a encoded string. So it can easily be decoded. Base64 makes a
string suitable for HTTP transfer plus it makes it a little hard to read . Read
More about Base64 Encoding .
Any body can decode that string and read the original value. so be careful
about that. There is a security lack
of view state.
4.
What is plain text?
Plain text is also called clear text.
5.
What is out proc Session in ASP?
Inproc session
mode,
1. session data is stored in current application
domain and so consumes memory of server machine.
2. if server restarts, all session data is lost.
Out-proc mode (which is generally state server),
1. session data is stored on state server and so
web servers memory is not consumed.
2. in case of web server restart, session data
is preserved.
Out-proc mode (which is generally state server),
1. session data is stored on state server and so
web servers memory is not consumed.
2. in case of web server restart, session data
is preserved.
considering above points, use of session mode is
the choice to be made considering load, no. of users, performence requirment
etc.
for small web site with limited no. of users,
in-proc mode is best suited.
for large applications with huge no. of users,
state-server/sql server session mode should be used.
1.
What is assembly in C#. How much type of combination it make and what is the
other resource in assembly.
Assemblies form the fundamental unit of
deployment, version control, reuse, activation scoping, and security
permissions for a .NET-based application. Assemblies take the form of an
executable (.exe) file or dynamic link library (.dll) file, and are the
building blocks of the .NET Framework. They provide the common language runtime
with the information it needs to be aware of type implementations. You can
think of an assembly as a collection of types and resources that form a logical
unit of functionality and are built to work together.
Assemblies can contain one or more modules.
For example, larger projects may be planned in such a way that several
individual developers work on separate modules, all coming together to create a
single assembly. For more information about modules, see the topic How to: Build a Multifile Assembly.
Assemblies have the following properties:
·
Assemblies
are implemented as .exe or .dll files.
·
You can
share an assembly between applications by putting it in the global assembly
cache. Assemblies must be strong-named before they can be included in the
global assembly cache. For more information, see Strong-Named Assemblies.
·
Assemblies
are only loaded into memory if they are required. If they are not used, they
are not loaded. This means that assemblies can be an efficient way to manage
resources in larger projects.
·
You can
programmatically obtain information about an assembly by using reflection. For
more information, see Reflection.
Within every assembly is an assembly
manifest. Similar to a table of contents, the assembly manifest
contains the following:
·
The
assembly's identity (its name and version).
·
A file
table describing all the other files that make up the assembly, for example,
any other assemblies you created that your .exe or .dll file relies on, or even
bitmap or Readme files.
·
An assembly
reference list, which is a list of all external dependencies—.dlls
or other files your application needs that may have been created by someone
else. Assembly references contain references to both global and private
objects. Global objects reside in the global assembly cache, an area available
to other applications, somewhat like the System32 directory. The Microsoft.VisualBasic namespace is an example of an assembly
in the global assembly cache. Private objects must be in a directory at either
the same level as or below the directory in which your application is
installed.
Because assemblies contain information about
content, versioning, and dependencies, the applications you create with Visual
Basic and C# do not rely on registry values to function properly. Assemblies
reduce .dll conflicts and make your applications more reliable and easier to
deploy. In many cases, you can install a .NET-based application simply by
copying its files to the target computer.
In C#, you can also use two versions of the
same assembly in a single application. For more information, see extern alias.
3.
By which command we register assembly in
GAC?
The following command installs the assembly mydll.dll into the global assembly cache.
gacutil /i mydll.dll
The following command removes the assembly hello from the global assembly cache as long as no
reference counts exist for the assembly.
gacutil /u hello
4.
How we make assembly key or Snk key?
1.
On the Start menu, point to All Programs, point
to Microsoft Visual
Studio 2010, point to Visual
Studio Tools, and then click Visual
Studio Command Prompt (2010).
2.
At the
command prompt, from the folder where you want to store the key file, type the
following command, and then press ENTER:
sn /k file_name .snk
Example: sn /k ErrorHandling.snk
A
confirmation message, Key
pair written to <file_name>.snk,
displays on the command line.
3.
In
Visual Studio Solution Explorer, right-click the project and then click Properties.
4.
Click the Signing tab and choose Browse in the Choose a strong name key file drop down box.
5.
Browse to
the key file and click it. Click Open,
and then close the project properties.
6.
Repeat
steps 3 through 6 for each project in the solution that you want to deploy
using this strong name assembly key file.
6.
How we decode a assembly?
7.
How much type of assembly in .Net C#?
2.
What is MSIL?
When compiling to managed code, the compiler
translates your source code into Microsoft intermediate language (MSIL), which
is a CPU-independent set of instructions that can be efficiently converted to
native code. MSIL includes instructions for loading, storing, initializing, and
calling methods on objects, as well as instructions for arithmetic and logical
operations, control flow, direct memory access, exception handling, and other
operations. Before code can be run, MSIL must be converted to CPU-specific
code, usually by a just-in-time (JIT) compiler. Because the
common language runtime supplies one or more JIT compilers for each computer
architecture it supports, the same set of MSIL can be JIT-compiled and run on
any supported architecture.
When a compiler produces MSIL, it also
produces metadata. Metadata describes the types in your code, including the
definition of each type, the signatures of each type's members, the members
that your code references, and other data that the runtime uses at execution
time. The MSIL and metadata are contained in a portable executable (PE) file
that is based on and extends the published Microsoft PE and common object file
format (COFF) used historically for executable content. This file format, which
accommodates MSIL or native code as well as metadata, enables the operating
system to recognize common language runtime images. The presence of metadata in
the file along with the MSIL enables your code to describe itself, which means
that there is no need for type libraries or Interface Definition Language
(IDL). The runtime locates and extracts the metadata from the file as needed
during execution.
5.
What is reflection in C#?
Reflection
(C# Programming Guide)
Visual Studio 2008
9 out of 19 rated this helpful
Reflection provides objects (of type Type) that describe assemblies, modules and
types. You can use reflection to dynamically create an instance of a type, bind
the type to an existing object, or get the type from an existing object and
invoke its methods or access its fields and properties. If you are using
attributes in your code, reflection enables you to access them. For more
information, see Attributes (C# Programming Guide).
Here's a simple example of reflection using
the static method GetType -
inherited by all types from the Object base
class - to obtain the type of a variable:
C#
// Using GetType to obtain type information:
int i = 42;
System.Type type = i.GetType();
System.Console.WriteLine(type);
The output is:
System.Int32
The following example uses reflection to
obtain the full name of the loaded assembly.
C#
// Using Reflection to get information from an Assembly:
System.Reflection.Assembly info = typeof(System.Int32).Assembly;
System.Console.WriteLine(info);
8.What
is the normalization?
Normalization
or data normalization is a process to organize the data into tabular format
(database tables). A good database design includes the normalization, without
normalization a database system may slow, inefficient and might not produce the
expected result. Normalization reduces the data redundancy and inconsistent
data dependency.
Normal Forms
We organize the data
into database tables by using normal forms rules or conditions. Normal forms
help us to make a good database design. Generally we organize the data up to
third normal form. We rarely use the fourth and fifth normal form.
To understand normal
forms consider the folowing unnormalized database table. Now we will normalize
the data of below table using normal forms.
1.
First Normal Form (1NF)
A database table is said to be in 1NF if it
contains no repeating fields/columns. The process of converting the UNF table
into 1NF is as follows:
1. Separate the repeating fields into new
database tables along with the key from unnormalized database table.
2. The primary key of new database tables may be
a composite key
1NF of above UNF table is as follows:
2.
Second Normal Form (2NF)
A database table is said to be in 2NF if it is
in 1NF and contains only those fields/columns that are functionally dependent(means
the value of field is determined by the value of another field(s)) on the
primary key. In 2NF we remove the partial dependencies of any non-key field.
The process of converting the database table
into 2NF is as follows:
1. Remove the partial dependencies(A type of
functional dependency where a field is only functionally dependent on the part
of primary key) of any non-key field.
2. If field B depends on field A and vice versa.
Also for a given value of B, we have only one possible value of A and vice versa,
Then we put the field B in to new database table where B will be primary key
and also marked as foreign key in parent table.
2NF of above 1NF tables is as follows:
3.
Third Normal Form (3NF)
A database table is said to be in 3NF if it is
in 2NF and all non keys fields should be dependent on primary key or We can
also said a table to be in 3NF if it is in 2NF and no fields of the table is
transitively functionally dependent on the primary key.The process of
converting the table into 3NF is as follows:
1. Remove the transitive dependecies(A type of
functional dependency where a field is functionally dependent on the Field that
is not the primary key.Hence its value is determined, indirectly by the primary
key )
2. Make separate table for transitive dependent
Field.
3NF of above 2NF tables is as follows:
4.
Boyce Code Normal Form
(BCNF)
A database table is said to be in BCNF if it
is in 3NF and contains each and every determinant as a candidate key.The
process of converting the table into BCNF is as follows:
1. Remove the non trival functional dependency.
2. Make separate table for the determinants.
BCNF of below table is as follows:
5.
Fourth Normal Form (4NF)
A database table is said to be in 4NF if it is
in BCNF and primary key has one-to-one relationship to all non keys fields or
We can also said a table to be in 4NF if it is in BCNF and contains no
multi-valued dependencies.The process of converting the table into 4NF is as
follows:
1. Remove the multivalued dependency.
2. Make separate table for multivalued Fields.
4NF of below table is as follows:
6.
Fifth Normal Form (5NF)
A database table is said to be in 5NF if it is
in 4NF and contains no redundant values or We can also said a table to be in
5NF if it is in 4NF and contains no join dependencies.The process of converting
the table into 5NF is as follows:
1. Remove the join dependency.
2. Break the database table into smaller and
smaller tables to remove all data redundancy.
5NF of below table is as follows:
jQuery is a fast, small, and feature-rich
JavaScript library. It makes things like HTML document traversal and
manipulation, event handling, animation, and Ajax much simpler with an
easy-to-use API that works across a multitude of browsers. With a combination
of versatility and extensibility, jQuery has changed the way that millions of
people write JavaScript.