What is HTTPS? Answer: HTTPS stands for Hypertext Transfer Protocol over Secure Socket Layer, or HTTP over SSL. HTTPS encrypts and decrypts the page requests and page information between the client browser and the web server using a secure Socket Layer (SSL). HTTPS by default uses port 443 as opposed to the standard HTTP port of 80. URL's beginning with HTTPS indicate that the connection between client and browser is encrypted using SSL. SSL transactions are negotiated by means of a keybased encryption algorithm between the client and the server, this key is usually either 40 or 128 bits in strength (the higher the number of bits the more secure the transaction). HTTPS should not be confused with S-HTTP, a security-enhanced version of HTTP. SSL and S-HTTP have very different designs and goals so it is possible to use the two protocols together. Whereas SSL is designed to establish a secure connection between two computers, S-HTTP is designed to send individual messages securely. Both protocols have been submitted to the Internet Engineering Task Force (IETF) for approval as a standard. ------------------------------------------------------- what is payment Gateway? Answer: Payment gateway protects credit cards details encrypting sensitive information, such as credit card numbers, to ensure that information passes securely between the customer and the merchant and also between merchant and payment processor. ------------------------------------------------------ what is Subdomain? Answer: If we type "www.cnn.com" into the address bar of our browser to visit the CNN website, then we are using what is known as a subdomain. Some people prefer to call this a "canonical", and we have also seen the term "third-level domain" (the logic is that ".com" is the top-level domain, "cnn" is the second level, and "www" is therefore the third). Certain countries, including the United Kingdom, have top level domains consisting of two "parts", e.g.: ".org.uk" or ".co.uk". The domain name "mycompany.co.uk" is therefore a "real" domain name, not a subdomain of "co.uk"! (Here, "sales.mycompany.co.uk" would be a subdomain.) Machine Names Subdomains are sometimes used to identify individual computers, each having an IP address of its own. In that case, the term "machine name" is sometimes used instead of "subdomain". A company could have two servers called "marketing.somefirm.com" and "accounting.somefirm.com", for example. The two computers would serve different departments, and contain different information. Subdomains For Load Balancing It's also possible to have multiple subdomains that identify different computers containing the same information. This arrangement is often used for extremely busy sites. A visitor types in: "www.busysite.com", and a mechanism called load balancing sends the visitor to one of the available computers (say, "www2.busysite.com" or "www7.busysite.com"). Organizing Information In most cases, however, subdomains are simply used to organize information with a website. An on-line shop could use the subdomains "books.someshop.com", "flowers.someshop.com", etc., to store related information together. An excellent example of a site that uses subdomains for this purpose is About.com. If you visit their site, you will notice that they use different subdomains for all of the topics they cover (e.g., "antiques.about.com" and "autorepair.about.com"). Of course, they could have used subdirectories instead ("about.com/antiques/"), but the use of subdomains makes it easy for them to move a topic to a dedicated computer if it turns out to be very popular. For a large, busy site like About, this "scalability" could be an important benefit. For most other sites, however, subdirectories work fine; they don't need the "200 subdomains" included in some "advanced" hosting packages. Subdomains: No Registration Fee! One key point to keep in mind is that, unlike domains, subdomains can be created "at will". For any domain, you can create as many subdomains as you like; you do not have to go to a registrar and pay an annual fee for each of them. ---------------------------------------------------------- why www."? (1999) Why does one use "www.foo.com" as a server name? Why not just "foo.com"? It is a convention. I suggested it early on, in this guide, and I am of two minds about it now. An alias was a better alternative to "pegasus.foo.com" which typically resulted when someone who happened to have a machine called pegasus started to run a web server for foo company. (The www prefix on a computer name also allows one to guess that it was a web server. This allowed early estimates of the numbers of servers, for example.) In those days I suggested an alias www.foo.com for the HTTP server in line with existing Internet practice of ftp.foo.com for the FTP server and mail.foo.com for the smtp server, and so on. These aliases could, even if originally on the same machine, be moved to point to machines of appropriate size as necessary. You don't have this flexibility of configuration is you point everyone at "foo.com" itself for all services. Typically early webmasters could not have comandeered the "foo.com" address itself. Nowadays, however, the web server may be far and away the biggest service foo company has, and it might make sense to give it pride of place. Remember you can only do this with one service. You could use http://foo.com/ which is after all easier to type, even though people expect to have to type the "www". Whatever you do, it is important not to do both. If you do both, you will halve the effectiveness of caching of your pages, as caches won't realise that the page under www.foo.com and under foo.com is the same. What we currently (1999) do in the W3C site it to redirect any traffic to w3.org to www.w3.org. So if you miss out the "www." by accident or for speed, them you end up at the canonical www.w3.org address. I would recommend doing a forward one way or the other whichever you chose as your web site's cannonical definitive address. ---------------------------------------------------------- What is Name Server? Answer: A name server translates domain names into IP addresses. This makes it possible for a user to access a website by typing in the domain name instead of the website's actual IP address. For example, when you type in "www.microsoft.com," the request gets sent to Microsoft's name server which returns the IP address of the Microsoft website. Each domain name must have at least two name servers listed when the domain is registered. These name servers are commonly named ns1.servername.com and ns2.servername.com, where "servername" is the name of the server. The first server listed is the primary server, while the second is used as a backup server if the first server is not responding. ----------------------------------------------------------- GPRS? Answer: General packet radio service (GPRS) is a packet oriented mobile data service available to users of the 2G cellular communication systems global system for mobile communications (GSM), as well as in the 3G systems. In the 2G systems, GPRS provides data rates of 56-114 kbit/s. ------------------------------------------------------------ IMAP? Answer: Internet Message Access Protocol (commonly known as IMAP, and previously called Internet Mail Access Protocol, Interactive Mail Access Protocol (RFC 1064), and Interim Mail Access Protocol[3]) is an Application Layer Internet protocol operating on port 143 that allows an e-mail client to access e-mail on a remote mail server. The current version, IMAP version 4 revision 1 (IMAP4rev1), is defined by RFC 3501. ------------------------------------------------------------ Sql Server new Version 2008. Microsoft .Net New Version 3.5 ------------------------------------------------------------ POP? Answer: In computing, the Post Office Protocol (POP) is an application-layer Internet standard protocol used by local e-mail clients to retrieve e-mail from a remote server over a TCP/IP connection. POP and IMAP (Internet Message Access Protocol) are the two most prevalent Internet standard protocols for e-mail retrieval. Virtually all modern e-mail clients and servers support both. The POP protocol has been developed through several versions, with version 3 (POP3) being the current standard. -------------------------------------------------------------- SMTP? Answer: Simple Mail Transfer Protocol (SMTP) is an Internet standard for electronic mail (e-mail) transmission across Internet Protocol (IP) networks. SMTP was first defined in RFC 821 (STD 10),[1] and last updated by RFC 5321 (2008)[2] which includes the extended SMTP (ESMTP) additions, and is the protocol in widespread use today. While electronic mail servers and other mail transfer agents use SMTP to send and receive mail messages, user-level client mail applications typically only use SMTP for sending messages to a mail server for relaying. --------------------------------------------------------------- XSL? Answer: XSL is a family of recommendations for defining XML document transformation and presentation. It consists of three parts: XSL Transformations (XSLT) a language for transforming XML the XML Path Language (XPath) an expression language used by XSLT to access or refer to parts of an XML document. (XPath is also used by the XML Linking specification) XSL Formatting Objects (XSL-FO) an XML vocabulary for specifying formatting semantics An XSLT stylesheet specifies the presentation of a class of XML documents by describing how an instance of the class is transformed into an XML document that uses a formatting vocabulary, such as (X)HTML or XSL-FO. For a more detailed explanation of how XSL works, see the What Is XSL page. --------------------------------------------------------------------- About Table? Answer: The HTML table model allows authors to arrange data -- text, preformatted text, images, links, forms, form fields, other tables, etc. -- into rows and columns of cells. Each table may have an associated caption (see the CAPTION element) that provides a short description of the table's purpose. A longer description may also be provided (via the summary attribute) for the benefit of people using speech or Braille-based user agents. Table rows may be grouped into a head, foot, and body sections, (via the THEAD, TFOOT and TBODY elements, respectively). Row groups convey additional structural information and may be rendered by user agents in ways that emphasize this structure. User agents may exploit the head/body/foot division to support scrolling of body sections independently of the head and foot sections. When long tables are printed, the head and foot information may be repeated on each page that contains table data. Authors may also group columns to provide additional structural information that may be exploited by user agents. Furthermore, authors may declare column properties at the start of a table definition (via the COLGROUP and COL elements) in a way that enables user agents to render the table incrementally rather than having to wait for all the table data to arrive before rendering. Table cells may either contain "header" information (see the TH element) or "data" (see the TD element). Cells may span multiple rows and columns. The HTML 4 table model allows authors to label each cell so that non-visual user agents may more easily communicate heading information about the cell to the user. Not only do these mechanisms greatly assist users with visual disabilities, they make it possible for multi-modal wireless browsers with limited display capabilities (e.g., Web-enabled pagers and phones) to handle tables. ------------------------------------------------------------ Server side code In a previous chapter, you learned that dynamic pages are created using code in asp.net web pages. When you request a page, the web server executes the code in the web page and generates an HTML content for that page. It is this HTML content that is sent back to the browser so that it can be displayed to the user. The code that is executed by the web server to generate the dynamic page is called "server side code". It is called "server side code" because it is executed by the web server. When you develop ASP.NET pages, you will use C# or VB.NET (or any other .NET compatible code) code to write the server side code. Server side code is used to retrieve and generate content for the dynamic pages. You may be using the code to retrieve the content from database or something like that. When a dynamic page is requested, the server side code is executed on the server and a page is generated. Once the generated page comes to the browser, there is connection with the server. You cannot do anything from the browser to communicate with the server, othen than requesting another page or same page again. So, if you want to access the database or something like that once the page is displayed, it is not possible. Client side code Client side code is used to do some kind of basic operations in the browser when the page is displayed to the user. As you read above, it is not possible to access the server once the page is displayed. Morover, the browser does not knwo anything about ASP.NET or .NET. The browser undersands only HTML and client side scripting languages. Client side coding is used to do basic operations on the browser. It cannot be used to access the server or database on the server etc. Client side coding is done using scripting languages like Javascript, VbScript, JScript etc. These scripting languages are easy to learn (they are different from vb.net and C#). The scripting languages provide only very minimal functionality. The main use of client side scripting is to validate user input before submitting a page to server. For example, suppose you have a "Registration" page. Once user enter all data and press the "submit" button, all the user input will be sent to server. In the server side, you may have written vb.net or C# code to validate all user inputs like Name cannot be empty etc. If the user do not enter a name and press submit, your server side code will generate an error message and return the page to you. In this case, the page was sent to the server and came back with an error message. It was an expensive operation. It consumed lot of resources to send a page to the server and get it back to the browser with an error message. If we can catch this validation error in the browser itself, instead of sending to server and coming back with an error, that will save lot of time and resources. User need not wait to send the page to server and come back. Since, a browser does not know VB.NET or C#, you cannot write such code to validate it in the browser. Client side scripting comes here to help. You can write Javascript, VBScript or JScript code to validate the name field in the browser itself and submit it to the server only if all user inputs are correct --------------------------------------------------------- Difference Between C#.net and C++? Answer: The similarities just about end here. Even a short list of differences would include (in no particular order and with no intended bias): C# has a common type hierarchy, C++ does not. All types in C#, even primitives, descend from the class Object, or can act as if they do. (Value types, described below, conceptually derive from Object, but actually require some implicit conversion—known as boxing—to participate in the inheritance hierarchy.) In C++ any type can be allocated on either the heap (via new) or on the stack. In C#, by contrast, there are reference types, which are always allocated on the heap (I'll ignore the stackalloc keyword for now), and value types which are always allocated on the stack. (Note that when I say "stack", this could also mean that the object's memory is directly stored within another type, in the case of members. What I really mean is that the object is directly accessible at its location, not indirectly accessible through a pointer.) C++ has multiple inheritance (of implementation), C# does not (although it does have multiple inheritance of interface). Speaking of which, C# has explicit keywords for interfaces and abstract base classes. C++ has those concepts, but they are not enforced by the language. C++ includes a very powerful—and more complex and difficult to master—template meta language. C# originally had nothing like it, with many people believing that the common type hierarchy obviated the need for such techniques. Version 2 of the language (as well as of the framework) conceded this position somewhat with the introduction of generics which provide some of the same functionality of templates (and look very similar, too). C# generics, however, are a very different animal from C++ templates. C# uses a garbage collector as part of the language spec. Many garbage collectors are available for C++, but this is not built into the language. C# has delegates, which are a powerful alternative to C++'s function pointers and pointers-to-members. C# has syntax for properties and events. C# has syntax that enforces such things as non-overridable members, non-inheritable, and static classes. It also makes attempts to eliminate member hijacking with explicit modifiers such as override and new (as applied to members). ////////////////////////////// C# is a distinct language from C++. C++ is designed for general object oriented programming in the days when the typical computer was a standalone machine running a command line-based user interface. C++ is a general-purpose programming language with high-level and low-level capabilities. It is a statically typed, free-form, multi-paradigm, usually compiled language supporting procedural programming, data abstraction, object-oriented programming, and generic programming. C++ is regarded as a mid-level language. This indicates that C++ comprises a combination of both high-level and low-level language features. C# is designed specifically to work with the .Net and is geared to the modern environment of Windows and mouse-controlled user interface, networks and the internet. Microsoft has defined C# as follows C# is a simple, modern, object oriented, and type-safe programming language derived from C and C++. C# (pronounced C sharp) is firmly planted in the C and C++ family tree of languages, and will immediately be familiar to C and C++ programmers. C# aims to combine the high productivity of Visual Basic and the raw power of C++. However it is also undeniable that the two languages are very similar in both their syntax and in that they are both designed to facilitate the same paradigm of programming, in which code is based around hierarchies of inherited classes. Below I will briefly summarize the overall differences and similarities between the two languages. Environment C++ was designed to be a low-level platform-neutral object-oriented programming language. C# was designed to be a somewhat higher-level component-oriented language. The move to a managed environment represents a sea change in the way you think about programming. C# is about letting go of precise control, and letting the framework help you focus on the big picture. With the managed environment of .NET, you give up that level of control. When you choose the type of your object, the choice of where the object will be created is implicit. Simple types (int, double, and long) are always created on the stack (unless they are contained within other objects), and classes are always created on the heap. You cannot control where on the heap an object is created, you can't get its address, and you can't pin it down in a particular memory location. (There are ways around these restrictions, but they take you out of the mainstream.) The very structure of C# reflects the underlying framework. There are no multiple inheritances and there are no templates because multiple inheritances are terribly difficult to implement efficiently in a managed, garbage-collected environment, and because generics have not been implemented in the framework. Compile Target C++ code usually compiles to assembly language. C# by contrast compiles to Intermediate language (IL), which has some similarities to java byte code. The IL is subsequently converted to native executable code by a process of Just-In-Time compilation. The emitted IL code is stored in a file or a set of files known as an assembly. An assembly essentially forms the unit, in which IL code id packaged, corresponding to a DLL, or executable file that would be created by C++ compiler. Memory Management C# is designed to free the developers from the task of doing memory management. It means in C# you do not have to explicitly delete memory that was allocated dynamically on the heap, as you could in C++. Rather, the garbage collector periodically cleans up memory that is no longer needed. Lets have two C++ variable declarations int j = 30; Myclass *pMine=new Myclass Here the contents of j are stored on the stack. This is exactly that exists with C# value types. Our Myclass instance is, however stored on the heap, and the pointer to it is on the stack. This is basically the situation with C# reference type, except that in C# the syntax dresses the pointer up as a reference. The equivalent of C# is: Int j=30; Myclass mine=new Myclass() This code has pretty much the same effect in terms of where the objects are stored as does the above C++ code - the difference is that Myclass is syntactically treated as a reference rather then a pointer. The big difference between C++ and C# is that C# doesn't allow you to choose how to allocate memory for a particular instance. For example, in C++ you wished to do this: Int* pj=new int(30); Myclass Mine;dfd This will cause the int to be allocated on the heap, and the Myclass instance to be allocated on the stack. You can't do this in C# because C# deems that an int is a value type while any class is always a reference type. The other difference is that there is no equivalent to C++ delete operator in C#. Instead, with C#, the .Net garbage collector periodically comes in and scans through the refrences in your code in order to identify which areas of the heap are currently in use by our program. It is then automatically able to remove all the objects that are no longer in use. This technique effectively saves you from having to free up nay memory yourself on the heap. Program Flow Program flow is similar in C# to C++. In particular, the following statements works exactly the same way as they do in C++ and have the same syntax : For, Return, Goto, Break, Continue New in C# : for each (1) If Else Condition If statement works exactly the same way and has exactly the same syntax in C# as in C++, apart from one point. The condition in each if and else clause must evaluate to a bool. For example, assuming x is an integer data types, not a bool, the following C++ code would generate a compilation error in C#. if(x) { } The correct syntax in C# If(x != 0) { } This shows that how additionally type safety in C# traps error early. While and do While Int x; While(x) //wrong While(x != 0) //OK Just as for if, these statements have exactly syntax and purpose in C# as they do in C++, except that the condition expression must evaluate to a bool. (2) Switch The switch statement serve the same purposes in C# as it does in C++. It is however; more powerful in C# since you can use a string as the test variables, something that is not possible in C++. In C# a switch statement may not "fall through" to the next statement if it does any work. Thus, while the following is legal in C++, it is not legal in C#: switch (i) { case 4: CallFuncOne(); case 5: // error, no fall through CallSomeFunc(); } To accomplish this, you need to use an explicit goto statement: switch (i) { case 4:CallFuncOne(); goto case 5; case 5: CallSomeFunc();} If the case statement does not work (has no code within it) then you can fall switch (i) { case 4: // fall through case 5: // fall through case 6: CallSomeFunc(); } (3) New control flow statement- for each C# provides an additional flow control statement, for each. For each loops across all items in array or collection without requiring explicit specification of the indices. Syntax: Foreach(double someElement in MyArray) { Console.WriteLine(someElement); } (4) Boxing In some cases you might wish to treat a value type as if it was a reference type. This is achieved by a process know as boxing. Syntactically this just means casting the variable to an object. Int j = 10; Object boxobj = (object) j; Boxing acts like any other cast, but you should be aware that it means the contents of the variables will be copies to the heap and a reference created. The usual reason for boxing a value in order to pass it to a method that expects a reference type as a parameter. You can also unbox value, simply by casting it back to its original type. Int j = 10; Object boxobj = (object) j; Int k = (int) boxobj; The process of unboxing will raise an exception if you attempt to cast to the wrong type and no cast is available for you to do the conversion. (5) Structs Structs are significantly different in C#. In C++ a struct is exactly like a class, except that the default inheritance and default access are public rather than private. In C# structs are very different from classes. Structs in C# are designed to encapsulate lightweight objects. They are value types (not reference types), so they're passed by value. In addition, they have limitations that do not apply to classes. For example, they are sealed, which means they cannot be derived from or have any base class other than System.ValueType, which is derived from Object. Structs cannot declare a default (parameter less) constructor. (6) Value Types and reference types C# distinguishes between value types and reference types. Simple types (int, long, double, and so on) and structs are value types, while all classes are reference types, as are Objects. Value types hold their value on the stack, like variables in C++, unless they are embedded within a reference type. Reference type variables sit on the stack, but they hold the address of an object on the heap, much like pointers in C++. Value types are passed to methods by value (a copy is made), while reference types are effectively passed by reference. (7) Classes Classes in C# follow much the same principles as in C++, though there are a few differences in both features and syntax. Class MyClass : MyBaseClass { Private string SomeFiels; Public in SomeMethod() { Return; } Classes defined in C# using what at first sight looks like much the same syntax as in C++, but there are numerous differences: There is no access modifier on the name of the base class. Inheritance is always public. A class can only be derived from one base class. If no base class is explicitly specified, then the class will automatically be derived from System.Object, which will give the class all the functionality of System.Object, the most commnly used of which is ToString(). In C++, the only types of class members are variables, functions, constructors, destructors and operator overloads, C# also permits delegates, events and properties. The access modifiers public, private and protected have the same meaning as in C++ but there are two additional access modifiers available: i. Internal ii. Protected internal C++ requires a semicolon after the closing brace at the end of a class definition. This is not required in C#. (8) Destructors C# implements a very different programming model for destructors to C++. This is because the garbage collection mechanism in C# implies that: There is less need for destructors, since dynamically allocated memory will get removed automatically. Since it is not possible to predict when the garbage collector will actually destroy a given object, if you do supply a destructor for a class, it is not possible to predict precisely when that destructor will be executed. Because memory is cleaned up behind the scenes of C#, you will find that only a small proportion of your classes actually require destructors. C# has two-stage destruction mechanism: The class should derive from IDisposable interface and implements Dispose () method. The class should separately implements at destructor, which is viewed as a reserve mechanism in case a client doesn't need to call Dispose() C# destructor looks, syntactically much like a C++ destructor, but it is totally different. The C# destructor is simply a shortcut for declaring a Finalize method that chain up to its base class. Thus writing ~MyClass() { // do work here } is identical to writing MyClass.Finalize() { // do work here base.Finalize(); } (9) Virtual methods must be explicitly overridden In C# the programmer's decision to override a virtual method must be made explicit with the override keyword. To see why this is useful, assume that a Window class is written by Company A, and that List Box and Radio Button classes were written by programmers from Company B using a purchased copy of the Company A Window class as a base. The programmers in Company B have little or no control over the design of the Window class, including future changes that Company A might choose to make. Now suppose that one of the programmers for Company B decides to add a Sort method to ListBox: public class ListBox : Window { public virtual void Sort(){"} } This presents no problems until Company A, the author of Window, releases version 2 of its Window class. It turns out that the programmers in Company A also added a Sort method public class Window: public class Window { // " public virtual void Sort() {"} } In C++ the new virtual Sort method in Windows would now act as a base method for the virtual Sort method in ListBox. The compiler would call the Sort method in ListBox when you intend to call the Sort in Window. In C# a virtual function is always considered to be the root of virtual dispatch, that is, once C# finds a virtual method, it looks no further up the inheritance hierarchy If a new virtual Sort function is introduced into Window the run-time behavior of ListBox is unchanged. When ListBox is compiled again, however, the compiler generates a warning: "\class1.cs(54,24): warning CS0114: 'ListBox.Sort()' hides inherited member 'Window.Sort()'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword. To remove the warning, the programmer must indicate what he intends. He can mark the ListBox Sort method new, to indicate that it is not an override of the virtual method in Window: public class ListBox : Window { public new virtual void Sort(){"} } This action removes the warning. If, on the other hand, the programmer does want to override the method in Window, he need only use the override keyword to make that intention explicit. (10) C# requires definite assignment C# requires definite assignment, which means that the local variables, age, ID, and yearsServed must be initialized before you call GetStats. This is unnecessarily cumbersome; you're just using them to get values out of GetStats. To address this problem, C# also provides the out keyword, which indicates that you may pass in uninitialized variables and they will be passed by reference. This is a way of stating your intentions explicitly: public class MyClass { public void GetStats(out int age, out int ID, out int yearsServed) { } } Again, the calling method must match. MyClass.GetStats(out age,out ID, out yearsServed); (11) Boolean Values Conversion There is no conversion between the bool type and other types (specifically int). C# Boolean values can not be treated as integer If you write a code like this if(BoolReturnFunction()) {} and check if it returns zero it will evaluate false and otherwise true However using assignment versus equality is not allowed ,if you write: if( x = 4 ) {} Where x is Boolean type variable, it will give you an compile error Constant value '4' cannot be converted to a 'bool' If you write like this: if(Convert.ToInt32(x)=4) {} it will give you compilation error Cannot implicitly convert type 'int' to 'bool' (12) Exceptions Exceptions are used in the same way in C# as in C++, apart from the following two differences: C# defines the finally block, which contains code that is always executed at the end of try block irrespective of whether any exception was thrown. The lack of this feature in C++ has been a common cause of complaint among C++ developers. The finally block is executed as soon as control leaves a catch or try block, and typically contains cleanup code for resources allocated in the try block. In C++, the class thrown in the exception may be any class. C#, however, requires that the exception be a class derived from System.Exception. C++ syntax for catch: Catch () {} C# syntax for catch: Catch { } The full syntax fro try..catch..finally in C# looks like this Try {} Catch (MyException e) {} Finally {} (13) Delegates- Substitute of Pointer C# does not support function pointers. However a similar effect is achieved by wrapping references to methods in special forms of class know as delegates. A delegate is a class that can hold a reference to a method. Unlike other classes, a delegate class has a signature, and it can hold references only to methods that match its signature. A delegate is thus equivalent to a type-safe function pointer or a callback. Delegates can be passed around between methods, and used to call the methods to which they contains reference, in the same way that function pointers can be in C++. Conceptually delegates can be used in a similar way to an interface with a single method. The main practical difference is that with an interface the method name is fixed, whereas with a delegate only the signature is fixed - the method name can be different // delegate declaration delegate void MyDelegate(int i); class Program { public static void Main() { TakesADelegate(new MyDelegate(DelegateFunction)); } public static void TakesADelegate(MyDelegate SomeFunction) { SomeFunction(21); } public static void DelegateFunction(int i) { System.Console.WriteLine("Called by delegate with number: {0}.", i) } } Output: Called by delegate with number: 21. (14) Properties Most C++ programmers try to keep member variables private. This data hiding promotes encapsulation and allows you to change your implementation of the class without breaking the interface your clients rely on. You typically want to allow the client to get and possibly set the value of these members, however, so C++ programmers create accessor methods whose job is to modify the value of the private member variables. In C#, properties are first-class members of classes. To the client, a property looks like a member variable, but to the implementer of the class it looks like a method. This arrangement is perfect; it allows you total encapsulation and data hiding while giving your clients easy access to the members. Properties are defined with property declarations. The first part of a property declaration resembles a field declaration. The second part includes a Get accessor and/or a Set accessor. In the example below, a class Employee defines a property Age. public class Employee { private static int age; public int Age { get (return age); set (age= value); } } (15) Attributes and Metadata. One significant difference between C# and C++ is that C# provides inherent support for metadata: data about your classes, objects, methods, and so forth. Attributes come in two flavors: those that are supplied as part of the CLR and attribute you create for your own purposes. CLR attributes are used to support serialization, marshaling, and COM interoperability. A search of the CLR reveals a great many attributes. As you've seen, some attributes are applied to an assembly, others to a class or interface. These are called the attribute targets. Attributes are applied to their target by placing them in square brackets immediately before the target item. Attributes may be combined, either by stacking one on top of another. [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile(".\\keyFile.snk")] or by separating the attributes with commas. [assembly: AssemblyDelaySign(false),assembly: AssemblyKeyFile (".\\keyFile.snk")] Custom Attributes - Custom attributes are user-defined attributes that provide additional information about program elements. For example, you might define a custom security attribute that specifies the permissions required by the caller to execute a procedure. [AttributeUsage(AttributeTargets.All)] public class DeveloperAttribute : System.Attribute { private string name; public DeveloperAttribute(string name) { this.name = name; } public virtual string Name { get (return name); } } -------------------------------------------------------------------- what is .com,.net,.org etc in domain name? Answer: Introduction When you use the Internet, you use domain name and hostnames all the time. These hostnames and domain names when put together become the Internet address that you search with. The domain name without a hostname is also the most common email address. This article will explore what hostnames and domain names are and how they are used. We will also discuss TLD's, or Top Level Domains, such as .Com, .Net, .Org, etc. Domain Names Domain Names are the unique name that identifies an entity, whether that be an single individual or a company, on the Internet. Domain Names always have 2 or more parts seperated by the dots. The leftmost piece is the most specific part while the right part is the TLD or Top Level Domain.. Lets disect a domain name so you can see what were are talking about. Take the domain name bleepingcomputer.com. This domain name consists of two parts. The leftmost part is the word that identifies the entity, in this situation its bleepingcomputer. This is a unique name and there can not be any duplicates on the rest of the Internet that are used by anyone else. The second part, or the rightmost part is the TLD, or Top Level Domain. This is .Com which means that it is a commercial organization. In the beginning there were only 5 Global TLD's that were recognized by everyone. These TLD's are discussed below: .com This TLD is intended for Commercial business around the world. .net This TLD is historically and is still used by Internet Service Providers. .org This TLD is intended to search the noncommercial community. .mil This TLD is restricted to use by the United States Military. .gov This TLD is restricted to use by United States Government Agencies. As the Internet grew and expanded throughout the world, new TLD's were created to represent different countries. For example the TLD .uk is for the United Kingdom and .au is for Australia. As more and more domains were registered, available domain names in the above TLD's were hard to come by. Due to this more TLD's such as .biz, .info, .name were created to allow more people to register domain names that fit their needs. Hostnames Hostnames can be a confusing as they have a double meaning. The hostname of an Internet Address is all of the left most pieces of a full internet address if there are more than 2 parts to the address. If there are only 2 parts of the address, then the hostname is equivalent to the domain name. Here are some examples: Full Address Hostname Domain Name TLD www.bleepingcomputer.com www bleepingcomputer.com com bleepingcomputer.com bleepingcomputer.com bleepingcomputer.com com www.google.net www google.net net my.www.bleepingcomputer.com my.www bleepingcomputer.com com As you can see from the examples the hostname can be many different things. If the entire address consists of only 2 parts, then the hostname is equivalent to the domain name. If the entire address consists of more than 2 parts, then the hostname is equivalent to all the left most pieces before the right 2 parts (or the domain name) To make things even more confusing, you can refer to the full address in its entirety as a hostname. For example, with www.bleepingcomputer.com: Bleepingcomputer.com is the domain name. www is the hostname www.bleepingcomputer.com is the hostname as well!!!