.NET basics Flashcards

1
Q

Common Language Runtime (CLR)

A

The engine that executes all .NET programs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Common Intermediate Language (CIL)

A

The language used by the CLR

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

C# strings and escaped characters

A
  • " (double quote)
  • \n (new line)
  • \t (horizontal tab)
  • \ (backward slash)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Arrays

A
  • string []
  • int []
  • int [,] (two-dimensional int array)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

ArrayList

A
  • Dynamic collection that supports any type of object and allows resizing
  • Example:
    • ArrayList x = new ArrayList();
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Delegates

A

Can be used as variables to point at methods that accept the same parameters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

script runat = “server”

A

Sets the code to run on the web server, rather than in the user’s web browser

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Generics

A

A class that supports any type of variables or objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Try parse

A
  • Returns a boolean representing the success or failure of the parse method
  • Example:
    • bool success = Decimal.TryParse(X.Value, out XX)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

if (IsPostBack == false)

A

Postback verifies that the page is being loaded for the first time. It is used in order to initialize content only on the first load

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

ListItem Class

A
  • Attributes - Gets a collection of attribute name and value pairs for the ListItem that are not directly supported by the class
  • Enabled - Gets or sets a value indicating whether the list item is enabled
  • Selected - Gets or sets a value indicating whether the item is selected
  • Text - Gets or sets the text displayed in a list control for the item represented by the ListItem
  • Value - Gets or sets the value associated with the ListItem
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

HtmlSelect Class

A
  • Value - Gets the value of the selected item in the HtmlSelect control or sets the SelectedIndex property of the control to the index of the first item in the list with the specified value
  • SelectedIndex - Gets or sets the ordinal index of the selected item in an HtmlSelect control
  • InnerText - Gets or sets the content between the opening and closing tags of the control with automatic conversion of special characters to their equivalent HTML entities. This property is not supported for this control.(Overrides HtmlContainerControl.InnerText)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Apply a CSS style to an HTML control

A

ControlName.Style[“AttributeName”] = “AttributeValue”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
  • InnerHtml
  • InnerText
A
  • The HTML content in the control
  • The text equivalent of the HTML content in the control
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Server.HtmlEncode

A

Property allowing to display an HTML element as a text element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

debug = true

A

Should be turned off when deployed to a server because it will slow down the application

17
Q

Units

A
  • Unit.Pixel ()
  • Unit.Percentage ()
18
Q

Color

A
  • ForeColor = Color.FromArgb()
  • ForeColor = Color. Crimson
  • ForeColor = ColorTranslator.FromHtml()
19
Q

Padding

A

padding: top right bottom left;

20
Q

Create tables

A
  • // Create a new TableRow object.
  • TableRow rowNew = new TableRow();
  • // Put the TableRow in the Table.
  • tbl.Controls.Add(rowNew);
21
Q

HTML postback events

A
  • HtmlButton.ServerClick Event
  • HtmlSelect.ServerChange Event
22
Q

Web control events

A
  • Click
  • TextChanged
  • CheckedChanged
  • SelectedIndexChanged
23
Q

Autopostback

A
  • Postback is done automatically as soon as the control is change
  • Example:
    • CheckBox id=”” runat=”server” AutoPostBack=”True” OnCheckedChanged=”Check_Clicked”
24
Q

_doPostBack

A

A Javascript function that is generated automatically when at least one control uses automatic postback. Sends the eventTarget and eventArgument to the server

25
Q

Find the control ID of the sender

A

string ctrlName = ((Control)sender).ID

26
Q
  • Page Load
  • Page Prerender
A
  • Page Load : Perform actions common to all requests, such as setting up a database query. At this point, server controls in the tree are created and initialized, the state is restored, and form controls reflect client-side data
  • Prerender :Perform any updates before the output is rendered. Any changes made to the state of the control in the prerender phase can be saved, while changes made in the rendering phase are lost
27
Q

Get an enumeration of know colors

A
  • string[] colorArray = Enum.GetNames(typeof(KnownColor));
  • lstBackColor.DataSource = colorArray;
  • lstBackColor.DataBind();
28
Q

Base ()

A
  • The base keyword is used to access members of the base class from within a derived class
  • Example:
    • public class DerivedClass : BaseClass
      • {
      • public DerivedClass() : base() { }
      • }
29
Q

Retaining member variables

A

Make a copy of them in the ViewState[“variableName”] during PreRender

30
Q

Placing an object in the view state

A

Add the keyword [serializable] before the class name

31
Q

Page.PreviousPage property

A
  • Is used to retrieve information from the previous page
  • Example:
    • CrossPage prevPage = PreviousPage as CrossPage;
      • if (prevPage != null)
      • {
        • lblInfo.Text += “You typed in this: “ + prevPage.FullName + “
          “;
      • }
32
Q

Url encoding

A
  • UrlEncode()
  • UrlDecode()
  • HttpServerUtility class & Page.Server Property
33
Q

Request.QueryString

A
  • The QueryString collection retrieves the values of the variables in the HTTP query string
  • Syntax:
    • Request.QueryString(variable)[(index)|.Count]
34
Q

Cookie Class (System.Net collection)

A
  • Example:
    • HttpCookie cookie = new HttpCookie(“preferences”)
    • Response.Cookies.Add(cookie)