Dot net basics pdf

Date published: 


CSharp and vitecek.info as Object Oriented Programming languages . NET. 1. vitecek.info Web applications: These include dynamic and data driven browser. NET Basics. •. vitecek.info Framework is a framework for developing and implementing software for personal computer, web etc. •. It was designed and is. vitecek.info is a web application framework developed and marketed by Microsoft to of expertise in vitecek.info programming from where you can take yourself to.

Language: English, Spanish, Arabic
Country: Slovakia
Genre: Science & Research
Pages: 511
Published (Last): 08.04.2016
ISBN: 169-7-44765-397-5
PDF File Size: 18.16 MB
Distribution: Free* [*Regsitration Required]
Uploaded by: MARCIE

6064 downloads 167629 Views 27.44MB ePub Size Report

Source: vitecek.info NET . ASP .NET / 4 programming language to have more lines of code than any other. security often did the best they could with a difficult programming model. . Attribute-based programming is used extensively vitecek.info to .. ASP. NET is much faster than ASP. For 98% of the code that programmers write, any small loss. NET (pronounced “dot net”) platform. Visual vitecek.info NET. From a programming viewpoint, Visual Basic is an object-oriented language that con- sists of two.

NET Architectural Concepts. Porting from. NET Framework. Development Guide. Client Development. Cross-platform development. C Language Reference.

What is the lapsed listener problem? The lapsed listener problem is one of the primary causes of leaks in. It occurs when a subscriber or listener signs up for a publishers event, butfails to unsubscribe. The failure to unsubscribe means that the publisher maintains areference to the subscriber as long as the publisher is alive. For some publishers, this maybe the duration of the application This situation causes two problems.

The obvious problem is the leakage of thesubscriber object. The other problem is the performance degredation due to the publishersending redundant notifications to zombie subscribers. There are at least a couple of solutions to the problem.

The simplest is to make surethe subscriber is unsubscribed from the publisher, typically by adding an Unsubscribe method to the subscriber. Another solution, documented here by Shawn Van Ness, is tochange the publisher to use weak references in its subscriber list. What is serialization? Serialization is the process of converting an object into a stream of bytes.

Deserialization is the opposite process, i. Does the. NET Framework have in-built support for serialization? There are two separate mechanisms provided by the. Both are available for use inyour own code I want to serialize instances of my class. It depends. However, on the plus side, XmlSerializer has good support forcustomising the XML document that is produced or consumed. XmlSerializers featuresmean that it is most suitable for cross-platform work, or for constructing objects fromexisting XML documents SoapFormatter and BinaryFormatter have fewer limitations than XmlSerializer.

Theycan serialize private fields, for example. However they both require that the target classbe marked with the [Serializable] attribute, so like XmlSerializer the class needs to bewritten with serialization in mind. Also there are some quirks to watch out for - forexample on deserialization the constructor of the new object is not invoked. The choice between SoapFormatter and BinaryFormatter depends on the application.

BinaryFormatter makes sense where both serialization and deserialization will beperformed on the. NET platform and where performance is important. SoapFormattergenerally makes more sense in all other cases, for ease of debugging if nothing else.

Learn ASP.NET: 30 Tutorials, Resources, Websites

Can I customise the serialization process? XmlSerializer supports a range of attributes that can be used to configureserialization for a particular class. For example, a field or property can be marked with the[XmlIgnore] attribute to exclude it from serialization. Another example is the[XmlElement] attribute, which can be used to specify the XML element name to be usedfor a particular property or field. Ultimate control of the serialization process can beacheived by implementing the the ISerializable interface on the class whose instances areto be serialized.

Why is XmlSerializer so slow? There is a once-per-process-per-type overhead with XmlSerializer. So the first timeyou serialize or deserialize an object of a given type in an application, there is a significantdelay. This normally doesnt matter, but it may mean, for example, that XmlSerializer is apoor choice for loading configuration settings during startup of a GUI application Why do I get errors when I try to serialize a Hashtable? XmlSerializer will refuse to serialize instances of any class that implementsIDictionary, e.

SoapFormatter and BinaryFormatter do not have thisrestriction. XmlSerializer is throwing a generic "There was an error reflectingMyClass" error. How do I find out what the problem is? Look at the InnerException property of the exception that is thrown to get a morespecific error message What are attributes?

There are at least two types of. NET attribute. The first type I will refer to asa metadata attribute - it allows some data to be attached to a class or method. This databecomes part of the metadata for the class, and like other class metadata can beaccessed via reflection. An example of a metadata attribute is [serializable], which can beattached to a class and means that instances of the class can be serialized.

Context attributes use a similar syntaxto metadata attributes but they are fundamentally different. If you have encountered Keith Browns universal delegator youll befamiliar with this idea. CAS is the part of the. NET security model that determines whether or not code isallowed to run, and what resources it can use when it is running.

For example, it is CASthat will prevent a. NET web applet from formatting your hard disk. How does CAS work?

ASP and ASP.NET Tutorials

The CAS security policy revolves around two key concepts - code groups andpermissions. NET assembly is a member of a particular code group, and each codegroup is granted the permissions specified in a named permission set. For example, using the default security policy, a control downloaded from a web sitebelongs to the Zone - Internet code group, which adheres to the permissions defined bythe Internet named permission set.

Naturally the Internet named permission setrepresents a very restrictive range of permissions. Im having some trouble with CAS. How can I troubleshoot the problem? Caspol has a couple of options that might help. First, you can ask caspol to tell youwhat code group an assembly belongs to, using caspol -rsg.

Similarly, you can ask whatpermissions are being applied to a particular assembly using caspol -rsp 9. I cant be bothered with CAS. Can I turn it off? Yes, as long as you are an administrator. Just run: Can I look at the IL for an assembly? MS supply a tool called Ildasm that can be used to view the metadata and IL foran assembly. Can source code be reverse-engineered from IL? Yes, it is often relatively straightforward to regenerate high-level source from IL.

How can I stop my code being reverse-engineered from IL? You can buy an IL obfuscation tool. These tools work by optimising the IL in such away that reverse-engineering becomes much more difficult Of course if you are writing web services then reverse-engineering is not a problemas clients do not have access to your IL.

Can I write IL programs directly? WriteLine class System. An exe assembly willbe generated. A couple of simple examples are that you can throw exceptions that are notderived from System.

Exception, and you can have non-zero-based arrays. This subject causes a lot of controversy, as youll see if you read the mailing listarchives. Take a look at the following two threads: Thisis mostly good, as a lot of COM was ugly. Generally speaking,. NET allows you topackage and use components in a similar way to COM, but makes the whole thing abit easier. Is DCOM dead? Pretty much, for. NET developers. Of course DCOM will still Not immediately.

The approach for. NET ones. Various tools and attributes were provided to make this aspainless as possible. Start with this message: Can I use COM components from. NET programs? COM components are accessed from the. NET-compatible interfaces. For oleautomation interfaces, the RCWcan be generated automatically from a type library. For non-oleautomation interfaces,it may be necessary to develop a custom RCW which manually maps the typesexposed by the COM interface to. NET-compatible types.

Can I use. This is similar to a RCW see previous question , but works in the oppositedirection. Again, if the wrapper cannot be automatically generated by the. Also, for COM to see the. NET component, the.

Pdf basics dot net

NET component mustbe registered in the registry. Is ATL redundant in the. NET world? ATL will continue to be valuable for writing COM components for some time,but it has no place in the.

NET world. How do I spawn a thread? Create an instance of a System. Thread object, passing it an instanceof a ThreadStart delegate that will be executed on the new thread.

For example: ThreadMain method: WaitUntilFinished ; How do I stop a thread? There are several options. First, you can use your own communicationmechanism to tell the ThreadStart method to finish. Alternatively the Thread class hasin-built support for instructing the thread to stop. The two principle methods areThread. Interrupt and Thread. The former will cause aThreadInterruptedException to be thrown on the thread when it next goes into aWaitJoinSleep state.

In other words, Thread. Interrupt is a polite way of asking thethread to stop when it is no longer doing any useful work. In contrast, Thread. Abort throws a ThreadAbortException regardless of what the thread is doing.

Furthermore,the ThreadAbortException cannot normally be caught though the ThreadStarts finallymethod will be executed. Abort is a heavy-handed mechanism which shouldnot normally be required. How do I use the thread pool? By passing an instance of a WaitCallback delegate to theThreadPool. How do I know when my thread pool work item has completed? There is no way to query the thread pool for this information. You must put codeinto the WaitCallback method to signal that it has completed.

Events are useful forthis.

You might also like: PDF READER FREE CNET

Maybe, but be careful. ReaderWriterLock is used to allow multiple threads toread from a data source, while still granting exclusive access to a single writer thread. This makes sense for data access that is mostly read-only, but there are somecaveats. First, ReaderWriterLock is relatively poor performing compared toMonitor. Second, you need to be verysure that the data structures you are accessing fully support multithreaded readaccess.

Finally, there is apparently a bug in the v1. Ian Griffiths has some interesting discussion on ReaderWriterLock here and here.

Net pdf dot basics

Yes, in the System. Diagnostics namespace. There are two main classes that dealwith tracing - Debug and Trace.

[PDF] .NET for Beginners free tutorial for Beginners

They both work in a similar way - the difference isthat tracing from the Debug class only works in builds that have the DEBUG symboldefined, whereas tracing from the Trace class only works in builds that have theTRACE symbol defined. Typically this means that you should useSystem. WriteLine for tracing that you want to work in debug andrelease builds, and System. WriteLine for tracing that you want towork only in debug builds. Can I redirect tracing to a file?

The Debug and Trace classes both have a Listeners property, which is acollection of sinks that receive the tracing that you send via Debug. WriteLine andTrace. WriteLine respectively. By default the Listeners collection contains a single sink,which is an instance of the DefaultTraceListener class. Log method. This is useful when debugging, but if youre trying to trace a problem at acustomer site, redirecting the output to a file is more appropriate.

Fortunately, theTextWriterTraceListener class is provided for this purpose. Create, FileAccess. Write ; Trace. WriteLine "This will be writen to c: Flush ;Note the use of Trace. Clear to remove the default listener. If you dont dothis, the output will go to the file and OutputDebugString.

Typically this is not whatyou want, because OutputDebugString imposes a big performance hit. Can I customise the trace output? You can write your own TraceListener-derived class, and direct all outputthrough it.

Heres a simple example, which derives from TextWriterTraceListener andtherefore has in-built support for writing to files, as shown above and adds timinginformation and the thread ID for each trace line: Write method isnot overridden for example.

The beauty of this approach is that when an instance of MyListener is added to theTrace. Listeners collection, all calls to Trace. WriteLine go through MyListener,including calls made by referenced assemblies that know nothing about theMyListener class.

Are there any third party logging components available? Log4net is a port of the established log4j Java logging component. How does. NET remoting work? NET remoting involves sending messages along channels. Support is provided for multiple message serializarion formats. But either channel can use either serializationformat. There are a number of styles of remote access: Each incoming request from a client is serviced by a new object. Theobject is thrown away when the request has finished.

All incoming requests from clients are processed by a single serverobject. This is the old stateful D COM model whereby the clientreceives a reference to the remote object and holds that reference thus keeping theremote object alive until it is finished with it. Distributed garbage collection of objects is managed by a system called leased basedlifetime.

Each object has a lease time, and when that time expires the object isdisconnected from the. NET runtime remoting infrastructure.

Objects have a defaultrenew time - the lease is renewed when a successful call is made from the client tothe object. The client can also explicitly renew the lease. NET program? Here is an example of C calling theWin32 MessageBox function: How do I write to the application configuration file at runtime?

What is .NET Framework? Complete Architecture Tutorial

You dont. See http: What is the difference between an event and a delegate? An event is just a wrapper for a multicast delegate. Adding a public event to aclass is almost the same as adding a public multicast delegate field.

In both cases,subscriber objects can register for notifications, and in both cases the publisher objectcan send notifications to the subscribers. However, a public multicast delegate has theundesirable property that external objects can invoke the delegate, something wednormally want to restrict to the publisher.

Hence events - an event adds publicmethods to the containing class to add and remove receivers, but does not make theinvocation mechanism public.

See this post by Julien Couvreur for more discussion. What size is a. NET object? Each instance of a reference type has two fields maintained by the runtime - amethod table pointer and a sync block. These are 4 bytes each on a bit system,making a total of 8 bytes per object overhead. Obviously the instance data for thetype must be added to this to get the overall size of the object. So, for example,instances of the following class are 12 bytes each: Values types have no equivalent overhead.

Will my. NET app run on bit Windows? The OSdecides which to use based on the PE header of the executable. Normally you specify any cpu, andyour app will run as bit on bit Windows and bit on bit Windows. Howeverif you have some bit native code in your app loaded via COM interop, forexample , you will need to specify x86, which will force bit Windows to load yourapp in a bit process. Some more explanation here: What is reflection? NET compilers produce metadata about the types defined in the modulesthey produce.

This metadata is packaged along with the module modules in turn arepackaged together in assemblies , and can be accessed by a mechanism calledreflection.

The System. Using reflection to access. Reflection can also be used to dynamically invoke methods seeSystem. InvokeMember , or even create types dynamically at run-time seeSystem. Generics, anonymous methods, partial classes, iterators, property visibility separate visibility for get and set and static classes. What are the new 2. Generics are useful for writing efficient type-independent code, particularlywhere the types might include value types.

The obvious application is containerclasses, and the. Generic namespace. Heres a simple example of a genericcontainer class being used: Add 10 ;Anonymous methods reduce the amount of code you have to write when usingdelegates, and are therefore especially useful for GUI programming. Heres anexample AppDomain. WriteLine "Processending Heres some sample code: WriteLine r ; Console. It effectively synthethises animplementation of IEnumerator, something we had to do manually in.

Whats the problem with. NET generics? NET generics work great for container classes. But what about other uses? Well,it turns out that. NET generics have a major limitation - they require the typeparameter to be constrained. For example, you cannot do this: Dispose isnot a method on System. Object, so the compilation fails. We can useconstraints to say that T implements a particular interface, but we cant dilute that tosimply say that T implements a particular method.

In fact, after writing generic code with interface constraints, we quickly see that wehavent gained much over non-generic interface-based programming. For example,we can easily rewrite the Disposer class without generics: Bruce Eckel: Whats new in the.

Here is a selection of new features in the. Note that C has special syntax for this type, e. Threading namespace. Cryptography namespace. Ipcnamespace, for optimised intra-machine communication. Click here to Register in Naukri. Net 1. Describe the role of inetinfo. NET requests among other things.

When an ASP. NET request is received usually a file with. Write andResponse. Write allows you to write formatted output. What methods are fired during the page load? Init - when the page is instantiated Load - when the page is loaded into server memory PreRender - the brief moment before the page is displayed to the user as HTML Unload - when page finishes loading.

When during the page processing cycle is ViewState What namespace does the Web page belong in the. NETFramework class hierarchy? CodeBehind is relevant to Visual Studio. NET only. When you have a complex control, like DataGrid, writing anevent processing routine for each object cell, button, row, etc. The controls can bubble up their eventhandlers,allowing the main DataGrid event handler to take care of itsconstituents.

Suppose you want a certain ASP. NET function executed onMouseOver for a certain button. Where do you add an eventhandler? Add an OnMouseOver attribute to the button. Add "onmouseover","someClientCodeHere ;" ; What data types do the RangeValidator control support? Integer, String, and Date. Explain the differences between Server-side and Client-side code?

Server-side code executes on the server. Client-side codeexecutes in the clients browser. What type of code server or client is found in a Code-Behind class? The answer is server-side code since code-behind is executedon the server. However, during the code-behinds execution on theserver, it can render client-side code such as JavaScript to beprocessed in the clients browser. But just to be clear, code-behindexecutes on the server, thus making it server-side code. Should user input data validation occur server-side orclient-side?

All user input data validation should occur on the server at aminimum. Additionally, client-side validation can be performedwhere deemed appropriate and feasable to provide a richer, moreresponsive experience for the user. What is the difference between Server. Transfer and Why would I choose one over the other?

Transfer transfers page processing from one pagedirectly to the next page without making a round-trip back to theclients browser. This provides a faster response with a little lessoverhead on the server. Transfer does not update the clientsurl history list or current url. Redirect is used to redirectthe users browser to another page or site. This performas a tripback to the client where the clients browser is redirected to the newpage.

The users browser history list is updated to reflect the newaddress. Can you explain the difference betweenan ADO. Valid answers are: NET comein different versions for different data sources. What is the Global. The Global. This is where you can set the specific variables for theApplication and Session objects.

Can you explain what inheritance is and an example ofwhen you might use it? When you want to inherit use the functionality of anotherclass. With a base class named Employee, a Managerclass could be derived from the Employee base class.

Whats an assembly? Assemblies are the building blocks of the. Overview of assemblies from MSDN Describe the difference between inline and code behind. Inline code written along side the html in a page. Code-behindis code written in a separate file and referenced by the. Explain what a diffgram is, and a good use for one? Whats MSIL, and why should my developers need anappreciation of it if at all? MSIL also allowsthe. Which method do you invoke on the DataAdapter controlto load your generated dataset with data?

The Fill method. Language - The first level is the programming language itself, the most common ones are VB. Net and C. Compiler — There is a compiler which will be separate for each programming language. So underlying the VB. Net language, there will be a separate VB. Net compiler.

Similarly, for C , you will have another compiler. Common Language Interpreter — This is the final layer in. Net which would be used to run a. So the subsequent compiler will send the program to the CLI layer to run the. Net application. Class Library The. NET Framework includes a set of standard class libraries.

A class library is a collection of methods and functions that can be used for the core purpose. For example, there is a class library with methods to handle all file-level operations. So there is a method which can be used to read the text from a file. Similarly, there is a method to write text to a file. Most of the methods are split into either the System. We will learn these namespaces more in detail in the subsequent chapters.

Languages The types of applications that can be built in the. Net framework is classified broadly into the following categories. WinForms — This is used for developing Forms-based applications, which would run on an end user machine.

Notepad is an example of a client-based application. Net — This is used for developing web-based applications, which are made to run on any browser such as Internet Explorer, Chrome or Firefox. The Web application would be processed on a server, which would have Internet Information Services Installed.

The result of the execution is then sent to the client machines, and the output is shown in the browser. Microsoft always ensures that. Net frameworks are in compliance with all the supported Windows operating systems. Net Framework Design Principle The following design principles of the. Net framework is what makes it very relevant to create. Net based applications. Interoperability - The. Net framework provides a lot of backward support. Suppose if you had an application built on an older version of the.

Net framework, say 2.

And if you tried to run the same application on a machine which had the higher version of the. Net framework, say 3. The application would still work. Contribute to. NET docs and samples. Discover the different step-by-step guides available for you to learn how to develop ASP. NET Core applications. Learn the basics of building an ASP. Learn about Azure Storage, and how to create applications using Azure blobs, tables, queues, and files.

Learn how you create Universal Windows apps that run on all Windows 10 devices. Write and debug your games using your game engine of choice with Visual Studio. Build games with C through tutorials and setup instructions at the MonoGame library documentation hub.

Bring AI to everyone with an end-to-end, scalable, trusted platform with experimentation and model management. Exit focus mode. Xamarin Cross-platform development Xamarin.

Related Documents

Copyright © 2019 vitecek.info. All rights reserved.