Tuesday 15 March, 2011

Exam 70–536 Microsoft .NET Framework 2.0

Q.1. You need to write a multicast delegate that accepts a DateTime argument and returns a Boolean value. Which code segment should you use?

A. public delegate int PowerDeviceOn ( bool, DateTime );

B. public delegate bool PowerDeviceOn ( Object, EventArgs );

C. public delegate void PowerDeviceOn ( DateTime );

D. public delegate bool PowerDeviceOn ( DateTime );


Q.2. You work as a developer at Company.com. You are creating an assembly named Company1. Company1 contains a public method. The global cache contains a second assembly named Company2.

You must ensure that the public method is only called from Company2. Which permission class should you use?

A. GacIdentityPermission

B. PublisherIdentityPermission

C. DataProtectionPermission

D. StrongNameIdentityPermission

Saturday 5 March, 2011

How to use '?:' operator in if condition

C#

string Abs;
Abs = Abs != "" ? "abc" : "cba";
VB

Dim Abs As String
Abs = If(Abs <> "", "abc", "cba")

Monday 28 February, 2011



The DataSet Object Model

Each DataSet object contains a DataTable collection, which is made up of
individual DataTable objects. The DataTable object has both DataRow and
DataColumn collections. A single DataRow holds the actual data for one record.
The DataRow object maintains the original values and any changed values.
This information is used to determine which rows have changed during program
execution.
A DataRelation object stores information about related tables, including
which columns contain the primary keys and foreign keys that link the tables.
The Constraints collection, which belongs to the DataTable object, holds
two types of Constraint objects: Unique constraints and ForeignKey constraints.
Unique constraints enforce the requirement that values in the specified field
be unique, which is usually required for primary key fields. ForeignKey constraints
require that any foreign key value that appears in a secondary table
match a primary key value in the primary table.

Note : See “Datasets in Visual Studio Overview” in Visual Studio Help.

Wednesday 5 January, 2011

Boxing and Unboxing

Hi there,

Check this out:

Say you have a page that perform simple calculation like below:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="BoxingUnBoxing.aspx.cs" Inherits="BoxingUnBoxing" %>

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

<title>Boxing Unboxingtitle>

head>

<body>

<form id="form1" runat="server">

<div>

<asp:TextBox ID="txtValue1" runat="server">asp:TextBox>

+

<asp:TextBox ID="txtValue2" runat="server">asp:TextBox>

=

<asp:TextBox ID="txtValue3" runat="server">asp:TextBox> <asp:Button ID="btnAdd"

runat="server" OnClick="btnAdd_Click" Text="Button" />div>

form>

body>

html>

On your code behind you have function to perform calculation

protected void btnAdd_Click(object sender, EventArgs e)

{

int value1 = Convert.ToInt32(txtValue1.Text); // unboxing, convert reference type to value type

int value2 = Convert.ToInt32(txtValue2.Text); // unboxing, convert reference type to value type

int value3 = value1 + value2; // calculate here

txtValue3.Text = Convert.ToString(value3); // boxing, convert value type back to reference type

}