Difference between array, arraylist, List, Hashtable, Dictionary and SortedList in c#

Basic difference is that arrays are of fixed size. Whereas an ArrayList implements the list data structure and can dynamically grow. While arrays would be more performance that a list, a list would be far more flexible since you don't need to know the required size initially. Array - represents an old-school memory array - kind of like a alias for a normal type[] array. Can enumerate. Can't grow automatically. I would assume very fast insertion, retrieve and speed. ArrayList - automatically growing array. Adds more overhead. Can enum., probably slower than a normal array but still pretty fast. These are used a lot in .NET List - one of my favorites - can be used with generics, so you can have a strongly typed array, e.g. List . Other than that, acts very much like ArrayList. Hashtable - plain old hashtable. O(1) to O(n) worst case. Can enumerate the value and keys properties, and do key/val pairs. Dictionary - same as above only strongly typed via generics, such a...

What are different ways to apply styles to a Web page

There are four ways to apply style to a Web page. 


  •  Inline CSS: HTML elements may have CSS applied to them via the STYLE attribute.You can always check HTML, CSS and JavaScript code impact using Online HTML Javascript editor.

 <p style=”font-size: 12px; color: #000000;”>Test </p>  



  • Embedded CSS: CSS may be embedded in a Web page by placing the code in a STYLE element within the HEAD element.For Example: If You have element into webpage, you can apply embedded style like shows in example.
 <head>  
<style type=”text/css”>
h2 {
font-size: 16px;
color: #2d2d2d;
font-weight: 900;
}
</style>
</head>


  • Linked CSS: CSS can be placed in an external file (a simple text file containing         CSS) and linked via the link element.You can apply style to webpage using external file as shown in example.

 <link rel=”stylesheet” href=”custom/custom.css” type=”text/css” media=”screen, projection” />  

  • Imported CSS: Another way to utilize external CSS files via @import.


 <style>  
@import url(‘/css/styles.css’);
</style>
Put then your “styles.css” document can contain calls to any number of additional
style sheets:
@import url(‘/css/typography.css’);
@import url(‘/css/layout.css’);
@import url(‘/css/color.css’);

Comments

Popular posts from this blog

C# Interview Questions on Inheritance

C# Interview Questions on value types and reference types

Why to use UpdatePanel control in AJAX ASP.NET?