Professional Documents
Culture Documents
<?xml version="1.0"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
a. int
b. double
c. float
d. boolean
e. Enumerated Data Types(Enums) . We will discuss about
enums and structs in our later article.
f. Struct types etc...
Private Assemblies
• PATH is not checked while looking up files, neither set by Control Panel
'System' configuration nor set in a Console Window.
ML Element
XML Attribute
If there are multiple values an attribute may have, then the value of the
attribute must be specified. For example, if a tag had a color attribute then
the value would be: red, blue, green, etc. The syntax for including an
attribute in an element is:
• <element attributeName="value">
In this example we will be using a madeup XML element named "friend" that
has an optional attribute age.
C# Example
static int totalruns(params int[] runs)
{
int score = 0;
for(int x=0; x
&nsbp;score+=runs[x];
return score;
}
Further, from the calling function, we may pass the scores of each
batsman as below...
score = totalruns(12,36,0,5,83,25,26);
E.g.
Int I =10;
A boxing conversion involves copying of the value being boxed.
E.g.
Object box = 11;
Int I = (int) box;
ADO.NET stands for ActiveX Data Objects for .NET. It refers to the
suite of data access technologies used to manipulate databases.
ADO.NET is part of the .NET Framework.
public Foo(int x)
{
// This is the implementation of
// the one-argument constructor
}
~Foo()
{
// This is the implementation of
// the destructor
}
}
}
}
20. Explain the role and format of .Net assemblies.
Assemblies in .Net are a solution to the Dll hell problem as one can use
different versions of same assembly in different applications at the same
time. To make a shared assembly, we need to register it with GAC where as
private assemblies reside in applications directory.
Web server controls are special ASP.NET tags understood by the server.
Like HTML server controls, Web server controls are also created on the
server and they require a runat="server" attribute to work. However, Web
server controls do not necessarily map to any existing HTML elements and
they may represent more complex elements.
<script runat="server">
Sub submit(Source As Object, e As EventArgs)
button1.Text="You clicked me!"
End Sub
</script>
<html>
<body>
<form runat="server">
<asp:Button id="button1" Text="Click me!"
runat="server" OnClick="submit"/>
</form>
</body>
</html>
This is a subset of the CTS which all .NET languages are expected to
support. It was always a dream of Microsoft to unite all different
languages in to one umbrella and CLS is one step towards that.
Microsoft has defined CLS which are nothing but guidelines that
language to follow so that it can communicate with other .NET
languages in a seamless manner. It is a set of types that may be
used in external calls in code that is intended to be portable. All of
the standardized framework (described in Partition IV, including the
Base Class Library, XML Library, Network Library, Reflection Library,
and Extended Numerics Library) are intended to be used on any
system running a compliant VES, and in any CLScompliant
language. Therefore, the framework follows the CLS rules, and all
(well, almost all) the types it defines are CLS-compliant to ensure
the broadest possible use. In the few cases in which types or
methods are not CLS-compliant, they are labeled as such (that’s
one of the CLS rules), and they are intended for use by compilers
and language runtimes rather than direct use by programmer
Initially XML received a lot of excitement, which has now died down
some. This isn't because XML is not as useful, but rather because it
doesn't provide the Wow! factor that other technologies, such as
HTML do. When you write an HTML document, you see a nicely
formatted page in a browser - instant gratification. When you write
an XML document, you see an XML document - not so exciting.
However, with a little more effort, you can make that XML document
sing!
Example:
<?xml version="1.0"?>
<person>
<name>
<firstname>Paul</firstname>
<lastname>McCartney</lastname>
</name>
<job>Singer</job>
<gender>Male</gender>
</person>
As the most important characteristics, the elements of the lists are of type
Object. Both keys and values of dictionaries are Objects. Without use of type
parametrization, there are no means to constraint the data in collections to
of a more specific type. Thus, if we for instance work with a collection of
bank accounts, we cannot statically guarantee that all elements of the
collection are bank accounts. We may accidentally insert an object of
another type. We will find the error at runtime. Most likely, an exception will
be raised when we try to cast an Object to BankAccount.
Both stacks and queues are like lists (ordered collections of items), but with
more restricted operations. They can both be implemented either using an
array or using a linked list to hold the actual items.
Stacks
_______ _________
/ \ / \
values in \/ / \/
| ----- | values out
| |
| ----- |
| |
| ----- |
| |
| |
----------
Think of a stack of newspapers, or trays in a cafeteria. The only item
that can be taken out (or even seen) is the most recently added
item; a stack is a Last-In-First-Out (LIFO) data structure.
OPERATION DESCRIPTION
boolean
return true iff the stack is empty
empty()
Queues
------------------
values in ----> items in the queue ----> values out
------------------
^ ^
| |
this is the rear of this is the front of
the queue the queue
Think of people standing in line. A queue is a First-In-First-Out (FIFO)
data structure. Items can only be added at the rear of the queue,
and the only item that can be removed is the one at the front of
the queue.
OPERATION DESCRIPTION
void
enqueue(Object add ob to the rear of the queue
ob)
You can use reflection to explore and examine the contents of an assembly.
You can find the types associated with a module; the methods, fields,
properties, and events associated with a type, as well as the signatures of
each of the type's methods; the interfaces supported by the type; and the
type's base class.
Polymorphism comes from the Greek words of poly and morphos. The literal
translation means "many forms", which in essence is how we use
polymorphism in programming.
A shape has many forms. Shape is just the generic name for them.
using System;
using System.Collections.Generic;
using System.Text;
namespace C_Sharp_Polymorphism_Tutorial
{
public class Program
{
static void Main(string[] args)
{
Parent[] obj = new Parent[2];
obj[0] = new Parent();
obj[1] = new Child();
}
}
• I had created two classes Parent and Child and define a method
PrintName().
• Then in Static Method I declare Array of Parent class which can hold
two elements in it In First index of Array “obj[0]” I instantiate object
of Parent Class and in Second Instantiate Child Class.
• Now Loop through this array and call PrintName method (Here it is I
am implementing polymorphism Calling child class method from
base class object).
***************** ****************