Friday, January 28, 2011

.NET Framework Version 3.5, LINQThe components of LINQ that are part of the .NET Framework 3.5 are,Expression Trees,


Vii).LINQ
Language-Integrated Query (LINQ) is a new feature in Visual Studio 2008 and the .NET Framework 3.5. LINQ extends powerful query capabilities to the language syntax of C# and Visual Basic in the form of standard, easily-learned query patterns. This technology can be extended to support potentially any kind of data store. The .NET Framework 3.5 includes LINQ provider assemblies that enable the use of LINQ for querying .NET Framework collections, SQL Server databases, ADO.NET Datasets, and XML documents.
1).The components of LINQ that are part of the .NET Framework 3.5 are:
The System.Linq namespace, which contains the set of standard query operators and types and interfaces that are used in the infrastructure of a LINQ query. This namespace is in the System.Core.dll assembly.
The System.Data.Linq namespace, which contains classes that support interaction with relational databases in LINQ to SQL applications.
The System.Data.Linq.Mapping namespace, which contains classes that can be used to generate a LINQ to SQL object model that represents the structure and content of a relational database.
The System.Xml.Linq namespace, which contains the classes for LINQ to XML. LINQ to XML is an in-memory XML programming interface that enables you to modify XML documents efficiently and easily. Using LINQ to XML, you can load XML, serialize XML, create XML trees from scratch, manipulate in-memory XML trees, and validate by using XSD. You can also use a combination of these features to transform XML trees from one shape into another.
New types in the System.Web.UI.WebControls and System.Web.UI.Design.WebControls namespaces. These new types, such as LinqDataSource, support the use of LINQ in ASP.NET Web pages through a data source control.
The DataRowComparer, DataRowExtensions, and DataTableExtensions classes in the System.Data namespace support LINQ queries against ADO.NET DataSet objects.
In the class library, the LINQ extension methods that apply to a class are listed in the members page for the class, in the Contents pane, and in the Index pane.
2).Expression Trees
Expression trees are new in the .NET Framework 3.5, and provide a way to represent language-level code in the form of data. The System.Linq.Expressions namespace contains the types that are the building blocks of expression trees. These types can be used to represent different types of code expressions, for example a method call or an equality comparison.
Expression trees are used extensively in LINQ queries that target remote data sources such as a SQL database. These queries are represented as expression trees, and this representation enables query providers to examine them and translate them into a domain-specific query language.
The System.Linq.Expressions namespace is in the System.Core.dll assembly.

.NET Framework Version 3.5, WPF support


Vi).WPF support
You can use Windows Forms to host Windows Presentation Foundation (WPF) controls and content together with Windows Forms controls. You can also open WPF windows from a Windows Form. For more information about how to use Windows Forms and WPF together, see Migration and Interoperability.

NET Framework Version 3.5, Windows Workflow Foundation,WCF and WF Integration—Workflow Services,Rules,Windows Forms,ClickOnce Improvements,Authentication, Roles, and Settings Services,Windows Vista Support,


V).Windows Workflow Foundation
1).WCF and WF Integration—Workflow Services
The .NET Framework 3.5 unifies the Windows Workflow Foundation (WF) and Windows Communication Foundation (WF) frameworks so that you can use WF as a way to author WCF services or expose your existing WF workflow as a service. This enables you to create services that can be persisted, can easily transfer data in and out of a workflow, and can enforce application-level protocols. For code samples, see Workflow Services Samples.
2).Rules
The WF rules engine now supports extension methods, operator overloading, and the use of the new operator in your rules. For more information, see Rule Changes in .NET Framework 3.5. For cde samples, see Rules and Conditions.
3).Windows Forms
4).ClickOnce Improvements
Several improvements have been made to ClickOnce. Improvements include deployment from multiple locations and third-party branding. For more information, see Deploying ClickOnce Applications For Testing and Production Servers without Resigning and Creating ClickOnce Applications for Others to Deploy.
The Mage.exe tool, which is sometimes used together with ClickOnce, has been updated for the .NET Framework 3.5. For more information, see Mage.exe (Manifest Generation and Editing Tool).
5).Authentication, Roles, and Settings Services
Client application services are new in the .NET Framework 3.5 and enable Windows-based applications (including Windows Forms and Windows Presentation Foundation applications) to easily access the ASP.NET login, roles, and profile services. These services enable you to authenticate users and retrieve user roles and application settings from a shared server.
You can enable client application services by specifying and configuring client service providers in your application configuration file or in the Visual Studio Project Designer. These providers plug into the Web extensibility model and enable you to access the Web services through existing .NET Framework login, roles, and settings APIs. Client application services also support occasional connectivity by storing and retrieving user information from a local data cache when the application is offline.
For more information, see Client Application Services.
6).Windows Vista Support
Existing Windows Forms applications work seamlessly on Windows Vista, and they are upgraded to have the same appearance as applications written specifically for Windows Vista whenever possible. Common file dialog boxes are automatically updated to the Windows Vista version. The .NET Framework 3.5 also supports the User Account Control (UAC) Shield icon. For more information, see FileDialog Class and Shield.

NET Framework Version 3.5, Windows Communication Foundation,WCF and WF Integration—Workflow Services,Durable Services,WCF Web Programming Model,WCF and Partial Trust,WCF and ASP.NET AJAX Integration,Web Services Interoperability,


iV).Windows Communication Foundation
1).WCF and WF Integration—Workflow Services

The .NET Framework 3.5 unifies the Windows Workflow Foundation (WF) and Windows Communication Foundation (WCF) frameworks so that you can use WF as a way to author WCF services or expose your existing WF workflow as a service. This enables you to create services that can be persisted, can easily transfer data in and out of a workflow, and can enforce application-level protocols. For code samples, see Workflow Services Samples.
2).Durable Services
The .NET Framework 3.5 also introduces support for WCF services that use the WF persistence model to persist the state information of the service. These durable services persist their state information on the application layer, so that if a session is torn down and re-created later, the state information for that service can be reloaded from the persistence store.
3).WCF Web Programming Model
The WCF Web Programming Model enables developers to build Web-style services with WCF. The Web Programming Model includes rich URI processing capability, support for all HTTP verbs including GET, and a simple programming model for working with a wide variety of message formats (including XML, JSON, and opaque binary streams). For more information, see WCF Web Programming Model Overview.
4).WCF Syndication
WCF now includes a strongly typed object model for processing syndication feeds, including both the Atom 1.0 and RSS 2.0 formats. For more information, see WCF Syndication. For code samples, see Syndication Samples.
5).WCF and Partial Trust
In .NET Framework 3.5, applications running with reduced permissions can use a limited subset of WCF features. Server applications running with ASP.NET Medium Trust permissions can use the WCF Service Model to create basic HTTP services. Client applications running with Internet Zone permissions (such as XAML Browser Applications or unsigned applications deployed with ClickOnce) can use the WCF proxies to consume HTTP services. In addition, the WCF Web Programming Model features (including AJAX and Syndication) are available for use by partially trusted applications. For more information, see Partial Trust.
6).WCF and ASP.NET AJAX Integration
The integration of WCF with the Asynchronous JavaScript and XML (AJAX) capabilities in ASP.NET provides an end-to-end programming model for building Web applications that can use WCF services. In AJAX-style Web applications, the client (for example, the browser in a Web application) exchanges small amounts of data with the server by using asynchronous requests. Integration with AJAX features in ASP.NET provides an easy way to build WCF Web services that are accessible by using client JavaScript in the browser. For more information, see ASP.NET AJAX Integration and JSON Support. For code samples, see AJAX Samples.
7).Web Services Interoperability
In the .NET Framework 3.5, Microsoft maintains its commitment to interoperability and public standards and introduces support for the new secure, reliable, and transacted Web services standards:
·         Web Services Reliable Messaging v1.1
·         Web Services Reliable Messaging Policy Assertion v1.1
·         WS-SecureConversation v1.3
·         WS-Trust v1.3
·         WS-SecurityPolicy v1.2
·         Web Services Atomic Transaction (WS-AtomicTransaction) Version 1.1
·         Web Services Coordination (WS-Coordination) Version 1.1
·         Web Services Policy 1.5 - Framework
·         Web Services Policy 1.5 - Attachment
Implementation of these protocols is made available using the new standard bindings, ws2007HttpBinding and ws2007FederationHttpBinding, which are documented in the Web Services Protocols Interoperability Guide. For a code sample, see WS Binding Samples.

NET Framework Version 3.5, Networking,Peer-to-Peer Networking,Collaboration Using Peer-to-Peer Networking,Socket Performance Enhancements


iii).Networking
1).Peer-to-Peer Networking
Peer-to-peer networking is a serverless networking technology that allows several network devices to share resources and communicate directly with each other. The System.Net.PeerToPeer namespace provides a set of classes that support the Peer Name Resolution Protocol (PNRP) that allows the discovery of other peer nodes through PeerName objects registered within a peer-to-peer cloud. PNRP can resolve peer names to IPv6 or IPv4 IP addresses.
2).Collaboration Using Peer-to-Peer Networking
The System.Net.PeerToPeer.Collaboration namespace provides a set of classes that support collaboration using the Peer-to-Peer networking infrastructure. These classes simplify the process by which applications can:
Track peer presence without a server.
Send invitations to participants.
Discover peers on the same subnet or LAN.
Manage contacts.
Interact with peers.
Microsoft’s Peer-to-Peer collaboration infrastructure provides a peer-to-peer network-based framework for collaborative serverless activities. Use of this framework enables decentralized networking applications that use the collective power of computers over a subnet or the Internet. These types of applications can be used for activities such as collaborative planning, communication, content distribution, or even multiplayer game matchmaking.

3).Socket Performance Enhancements
The Socket class has been enhanced for use by applications that use asynchronous network I/O to achieve the highest performance. A series of new classes have been added as part of a set of enhancements to the Socket namespace. These classes provide an alternative asynchronous pattern that can be used by specialized high-performance socket applications. These enhancements were specifically designed for network server applications that require the high-performance.

Common Language Runtime,Collections,Diagnostics,I/O and Pipes,Garbage Collection,Threading,TimeZoneInfo,DateTimeOffset,Cryptography,ClickOnce Manifests,algorithms


II).Common Language Runtime
1).Collections
HashSet(Of T) provides high performance set operations to the .NET Framework. A set is a collection that contains no duplicate elements, and whose elements are in no particular order. For more information, see HashSet Collection Type.
2).Diagnostics
The EventSchemaTraceListener class provides tracing of end-to-end, schema-compliant events. You can use end-to-end tracing for a system that has heterogeneous components that cross thread, AppDomain, process, and computer boundaries. A standardized event schema (see Event Representation for Event Consumers) has been defined to enable tracing across these boundaries. This schema is shared by various tracing technologies, including Windows Vista diagnostics tools such as Event Viewer. The schema also enables the addition of custom, schema-compliant elements.
The EventSchemaTraceListener class is tuned for logging performance with implicit support for lock-free tracing.
3).I/O and Pipes
Pipes provide interprocess communication between any processes running on the same computer, or on any other Windows computer within a network. The .NET Framework provides access to two types of pipes: anonymous pipes and named pipes. For more information about pipes, see Pipes.
4).Garbage Collection
The GCSettings class has a new LatencyMode property that you can use to adjust the time that the garbage collector intrudes in your application. You set this property to one of the values of the new GCLatencyMode enumeration.
The GC class has a new Collect(Int32, GCCollectionMode) method overload that you can use to adjust the behavior for a forced garbage collection. For example, you can use this overload to specify that the garbage collector should determine whether the current time is optimal to reclaim objects. This overload takes a value from the new GCCollectionMode enumeration.
Reflection and Reflection Emit in Partial Trust
Assemblies that run with partial trust can now emit code and execute it. Emitted code that calls only public types and methods needs no permissions beyond the permissions demanded by the types and methods that are accessed. The new DynamicMethod(String, Type, Type()) constructor makes it easy to emit such code.
When emitted code needs to access private data, the new DynamicMethod(String, Type, Type(), Boolean) constructor allows restricted access. The host must grant ReflectionPermission with the new RestrictedMemberAccess flag to enable this feature, which gives emitted code the ability to access private data only for types and methods in assemblies with equal or lesser trust levels. See Walkthrough: Emitting Code in Partial Trust Scenarios.
For reflection, a host grant of RestrictedMemberAccess similarly allows restricted use of methods that access private properties, call private methods, and so on, but only for target assemblies with equal or lesser trust levels.
5).Threading
Better Reader/Writer Lock
The new ReaderWriterLockSlim class provides performance that is significantly better than ReaderWriterLock, and comparable with the lock statement (SyncLock in Visual Basic). Transitions between lock states have been simplified to make programming easier and to reduce the chances of deadlocks. The new class supports recursion to simplify migration from lock and from ReaderWriterLock.
ThreadPool Performance Enhancements
Throughput for the dispatch of work items and I/O tasks in the managed thread pool is significantly improved. Dispatch is now handled in managed code, without transitions to unmanaged code and with fewer locks. The use of ThreadPool is recommended over application-specific thread pool implementations.
Time Zone Improvements
Two new types, DateTimeOffset and TimeZoneInfo, improve support for time zones and make it easier to develop applications that work with dates and times in different time zones. For a discussion of which type to use in particular situations, see Choosing Between DateTime, DateTimeOffset  and TimeZoneInfo.
6).TimeZoneInfo
The new TimeZoneInfo class largely supplants the existing TimeZone class. You can use TimeZoneInfo to retrieve any time zone defined in the registry, rather than just the local time zone and Coordinated Universal Time (UTC). You can also use this class to define custom time zones, to serialize and deserialize custom time zone data, and to convert times between time zones. For more information about developing applications that use the TimeZoneInfo class, see Times and Time Zones.
7).DateTimeOffset
The new DateTimeOffset structure extends the DateTime structure to make working with times across time zones easier. The DateTimeOffset structure stores date and time information as a UTC date and time together with an offset value that indicates how much the time differs from UTC.
8).Cryptography
9).ClickOnce Manifests
There are new cryptography classes for verifying and obtaining information about manifest signatures for ClickOnce applications. The ManifestSignatureInformation class obtains information about a manifest signature when you use its VerifySignature method overloads. You can use the ManifestKinds enumeration to specify which manifests to verify. The result of the verification is one of the SignatureVerificationResult enumeration values. The ManifestSignatureInformationCollection provides a read-only collection of ManifestSignatureInformation objects of the verified signatures. In addition, the following classes provide specific signature information:
·         StrongNameSignatureInformation
·         Holds the strong name signature information for a manifest.
·         AuthenticodeSignatureInformation
·         Represents the Authenticode signature information for a manifest.
·         TimestampInformation
·         Contains information about the time stamp on an Authenticode signature.
·         TrustStatus
·         Provides a simple way to check whether an Authenticode signature is trusted.
·         Suite B Support
The .NET Framework 3.5 supports the Suite B set of cryptographic algorithms published by the National Security Agency (NSA). For the NSA documentation, see www.nsa.gov/ia/industry/crypto_suite_b.cfm.

The following algorithms are included:

Advanced Encryption Standard (AES) with key sizes of 128 and 256 bits for encryption.
Secure Hash Algorithm (SHA-256 and SHA-384) for hashing.
Elliptic Curve Digital Signature Algorithm (ECDSA) using curves of 256-bit and 384-bit prime moduli for signing. This algorithm is provided by the ECDsaCng class. It allows you to sign with a private key and verify with a public key.
Elliptic Curve Diffie-Hellman (ECDH) using curves of 256 and 384-bit prime moduli for key exchange/secret agreement. This algorithm is provided by the ECDiffieHellmanCng class.
Managed code wrappers for the Federal Information Processing Standard (FIPS) certified implementations of the AES, SHA-256, and SHA-384 implementations are available in the new AesCryptoServiceProvider, SHA256CryptoServiceProvider, and SHA384CryptoServiceProvider classes.
The Cryptography Next Generation (CNG) classes provide a managed implementation of the native Crypto API (CAPI). Central to this group is the CngKey key container class, which abstracts the storage and use of CNG keys. This class allows you to store a key pair or a public key securely and refer to it using a simple string name. The ECDsaCng and ECDiffieHellmanCng classes use CngKey objects.
The CngKey class is used for a variety of additional operations, including opening, creating, deleting, and exporting keys. It also provides access to the underlying key handle to use when calling native APIs directly.
There are a variety of supporting CNG classes, such as CngProvider, which maintains a key storage provider, CngAlgorithm, which maintains a CNG algorithm, and CngProperty, which maintains commonly used key properties.

What's New in the .NET Framework Version 3.5,NET Compact Framework ,ASP.NET,Add-Ins and Extensibility,Discovery,Activation,Isolation,Sandboxing,UI Composition,Versioning,


What's New in the .NET Framework Version 3.5
This topic contains information about new and enhanced features in the .NET Framework version 3.5.
I).NET Compact Framework
The .NET Compact Framework version 3.5 expands support for distributed mobile applications by including the Windows Communication Foundation (WCF) technology. It also adds new language features such as LINQ, new APIs based on community feedback, and improves debugging with updated diagnostic tools and features.
2).ASP.NET
The .NET Framework 3.5 includes enhancements in targeted areas of ASP.NET and Visual Web Developer. The most significant advance is improved support for the development of AJAX-enabled Web sites. ASP.NET supports server-centric AJAX development with a set of new server controls and APIs. You can enable an existing ASP.NET 2.0 page for AJAX by adding a ScriptManager control and an UpdatePanel control so that the page can update without requiring a full page refresh.
ASP.NET also supports client-centric AJAX development with a new client library called the Microsoft AJAX Library. The Microsoft AJAX Library supports client-centric, object-oriented development, which is browser-independent. By using the library classes in your ECMAScript (JavaScript) you can enable rich UI behaviors without roundtrips to the server. You can mix the degree of server-centric and client-centric development to meet the needs of your application. Furthermore, Visual Web Developer includes improved IntelliSense support for JavaScript and support for the Microsoft AJAX Library.
ASP.NET and Visual Web Developer now support the creation of both ASMX and WCF-based Web services and the seamless use of either implementation from Web pages using Microsoft AJAX Library. Furthermore, server-side application services including forms authentication, roles management, and profiles are now exposed as Web services that can be consumed in WCF-compatible applications, including client script and Window Forms clients. ASP.NET enables all Web-based applications to share these common application services.
Other improvements in ASP.NET include a new data control, ListView, for displaying data; a new data source control, LinqDataSource, that exposes Language Integrated Query (LINQ) to Web developers through the ASP.NET data source control architectures; a new tool, ASP.NET Merge Tool (Aspnet_merge.exe), for merging precompiled assemblies; and tight integration with IIS 7.0. ListView is a highly customizable control (using templates and styles) that also supports edit, insert, and delete operations, as well as sorting and paging functionality. The paging functionality for ListView is provided by a new control called DataPager. You can use the merge tool to combine assemblies to support a range of deployment and release management scenarios. The integration of ASP.NET and IIS 7.0 includes the ability to use ASP.NET services, such as authentication and caching, for any content type. It also includes the ability to develop server pipeline modules in ASP.NET managed code and supports unified configuration of modules and handlers.
Other improvements in Visual Web Developer include multitargeting support, inclusion of Web Application Projects, a new Design view, new Cascading Style Sheets (CSS) design tools, and support for LINQ for SQL databases. Multitargeting enables you to use Visual Web Developer to target development of Web applications to specific versions of the .NET Framework, including versions 2.0, 3.0, and 3.5.
3).Add-Ins and Extensibility
The System.AddIn.dll assembly in the .NET Framework 3.5 provides powerful and flexible support to developers of extensible applications. It introduces a new architecture and model that helps developers with the initial work to add extensibility to an application and by ensuring that their extensions continue working as the host application changes. The model provides the following features:
4).Discovery
You can easily find and manage sets of add-ins in multiple locations on a computer with the AddInStore class. You can use this class to search for and obtain information about add-ins by their base types without having to load them.
5).Activation
After an application chooses an add-in, the AddInToken class makes it easy to activate. Simply choose the isolation and sandboxing level and the system takes care of the rest.
6).Isolation
There is built-in support for application domains and process isolation of add-ins. The isolation level for each add-in is in the control of the host. The system handles loading application domains and processes and shutting them down after their add-ins have stopped running.
7).Sandboxing
You can easily configure add-ins with either a default or customized trust level. Support includes Internet, Intranet, Full Trust, and “same-as-host” permission sets, as well as overloads that let the host specify a custom permission set.
8).UI Composition
The add-in model supports direct composition of Windows Presentation Foundation (WPF) controls that span application domain boundaries. You can easily allow add-ins to contribute directly to the UI of the host while still retaining the benefits of isolation, ability to unload, sandboxing, and versioning.
9).Versioning
The add-in architecture makes it possible for hosts to introduce new versions of their object model without breaking existing add-ins or impacting the developer experience for new ones.

WPF Interview Questions ,What is a Routed event?



In a typical WPF application, it contains many elements. These elements exist in an element tree relationship with each other. A routed event is a type of event that can invoke handlers on multiple listeners in an element tree, rather than just on the object that raised the event.

WPF Interview Questions ,Can you create Windows Service Using WPF?



No, you can not build the windows Services using WPF. WPF is presentation technolgy, where as Windows service requires certain permission to perform the certain GUI retalted operations.

If the Windows service does not have the appropriate permissions, there may be unexpected results.

WPF Interview Questions ,What are possible ways to implement distributed applications in .NET?



.NET Remoting and ASP.NET Web Services.

WPF Interview Questions ,Can BAML be decompiled back into XAML?



Sure, because an instance of any public .NET class can be serialized as XAML, regardless of how it was

 originally declared. The first step is to retrieve an instance that you want to be the root. If you don’t already

 have this object, you can call the static System.Windows.Application.LoadComponent method as follows:

System.Uri uri = new System.Uri(“MyWindow.xaml”, System.UriKind.Relative);

Window window = (Window)Application.LoadComponent(uri);

This differs from previous code that uses FileStream to load a .xaml file because with

LoadComponent, the name specified as the Uniform Resource Identifier (URI) does not have

to physically exist as a standalone .xaml file. LoadComponent can automatically retrieve

BAML embedded as a resource when given the appropriate URI (which, by MSBuild convention,

is the name of the original XAML source file). In fact, Visual Studio’s autogenerated

InitializeComponent method calls Application.LoadComponent to load embedded BAML,

although it uses a different overload.

After you’ve gotten a hold of the root element instance, you can use the

System.Windows.Markup.XamlWriter class to get a XAML representation of the root

element (and, therefore, any of its children). XamlWriter contains five overloads of a static

Save method, the simplest of which accepts an object instance and returns appropriate

XAML as a string. For example:

string xaml = XamlWriter.Save(window);

It might sound a little troubling that BAML can be so easily “cracked open,” but it’s really no

different from any other software running locally or displaying UI locally. (For example, you can

easily dig into a website’s HTML, JavaScript, and Cascading Style Sheets [CSS] files.)

WPF Interview Questions ,How do I retrieve command-line arguments in my WPF application?



Command-line arguments are typically retrieved via a string array parameter passed to Main, but the common way to define WPF applications doesn’t allow you to implement the Main method. You can get around this in two different ways. One way is to forego defining an Application-derived class in XAML, so you can manually define the Main method with a string array parameter. The easier way, however, is to simply call System.Environment.GetCommandLineArgs at any point in your application, which returns the same string array you’d get inside Main.



WPF Interview Questions ,Where’s the entry point in WPF application?



When you create a WPF Windows Application in Visual Studio, the generated project has no Main method, yet it still runs as expected! In fact, even attempting to add a Main method gives a compilation error telling you that it is already defined.

Application is special-cased when it is compiled from XAML, because Visual Studio assigns the XAML file a Build Action of ApplicationDefinition. This causes a Main method to be autogenerated.

WPF Interview Questions ,What unit of measurement is used by WPF?



All absolute measurements, such as the numbers used in this section’s size-related properties, are specified in device-independent pixels. These “logical pixels” are meant to represent 1/96th of an inch, regardless of the screen’s DPI setting. Note that device-independent pixels are always specified as double values, so they can be fractional.

The exact measurement of 1/96th of an inch isn’t important, although it was chosen because on a typical 96 DPI display, one device-independent pixel is identical to one physical pixel. Of course, the notion of a true “inch” depends on the physical display device. If an application draws a one-inch line on my laptop screen, that line will certainly be longer than one inch if I hook up my laptop to a projector!

WPF Interview Questions ,How can I make TextBox support multiple lines of text?


Setting AcceptsReturn to true allows users to press the Enter key to create a new line of


text. Note that TextBox always supports multiple lines of text programmatically. If its Text is

set to a string containing NewLine characters, it displays the multiple lines regardless of the

value of AcceptsReturn. Also, the multiline support is completely independent from text

wrapping. Text wrapping only applies to individual lines of text that are wider than the

TextBox.


WPF Interview Questions ,How can I get items in a StatusBar to grow proportionally?



It’s common to want StatusBar panes that remain proportionately sized. For example,

perhaps you want a left pane that occupies 25% of the StatusBar’s width and a right pane

that occupies 75% of the width. This can be done by overriding StatusBar’s ItemsPanel with

a Grid and configuring the Grid’s columns appropriately.

WPF Interview Questions ,How do I get the items in my ItemsControl to have Automation IDs, as seen in tools like UISpy?



The easiest way to give any FrameworkElement an Automation ID is to set its Name property, as that gets used by default for automation purposes. However, if you want to give an element an ID that is different from its name, simply set the AutomationProperties.AutomationID attached property (from the System.Windows.Automation namespace) to the desired string.



WPF Interview Questions ,How can I get ListBox to scroll smoothly?



By default, ListBox scrolls on an item-by-item basis. Because the scrolling is based on each

item’s height, it can look quite choppy if you have large items. If you want smooth scrolling,

such that each scrolling action shifts the items by a small number of pixels regardless of

their heights, the easiest solution is to set the ScrollViewer.CanContentScroll attached

property to false on the ListBox. Be aware, however, that by making this change you lose ListBox’s virtualization functionality. Virtualization refers to the optimization of creating child elements only when they become visible on the screen. Virtualization is only possible when using data binding to fill the control’s items, so setting CanContentScroll to false can negatively impact the performance of data-bound scenarios only.

WPF Interview Questions ,How can I make ListBox arrange its items horizontally instead of vertically?



One way is to define a new control template, but all ItemsControls provide a shortcut with its ItemsPanel property. ItemsPanel enables you to swap out the panel used to arrange items while leaving everything else about the control intact. ListBox uses a panel called VirtualizingStackPanel to arrange its items vertically, but the following code replaces it with a new VirtualizingStackPanel that explicitly sets its Orientation to Horizontal:

The translation of this XAML to procedural code is not straightforward, but here’s how you

can accomplish the same task in C#:

FrameworkElementFactory panelFactory =

new FrameworkElementFactory(typeof(VirtualizingStackPanel));

panelFactory.SetValue(VirtualizingStackPanel.OrientationProperty,

Orientation.Horizontal);

myListBox.ItemsPanel = new ItemsPanelTemplate(panelFactory);

WPF Interview Questions ,Why should I bother wrapping items in a ComboBoxItem?



ComboBoxItem exposes some useful properties—IsSelected and IsHighlighted—and

useful events—Selected and Unselected. Using ComboBoxItem also avoids a quirky behavior with showing content controls in the selection box (when IsEditable is false): If an item in a ComboBox is a content control, the entire control doesn’t get displayed in the selection box. Instead, the inner content is extracted and shown. By using ComboBoxItem as the outermost content control, the inner content is now the entire control that you probably wanted to be displayed in the first place. Because ComboBoxItem is a content control, it is also handy for adding simple strings to a ComboBox (rather than using something like TextBlock or Label).

WPF Interview Questions ,When the SelectionChanged event gets raised, how do I get the new selection?



The SelectionChanged event is designed to handle controls that allow multiple selections,

so it can be a little confusing for a single-selection selector such as ComboBox. The

SelectionChangedEventArgs type passed to event handlers has two properties of type

IList: AddedItems and RemovedItems. AddedItems contains the new selection and

RemovedItems contains the previous selection.

e.g.

void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)

{

if (e.AddedItems.Count > 0)

object newSelection = e.AddedItems[0];

}

Like this code, never assume that there’s a selected item! Besides the fact that ComboBox’s

selection can be cleared programmatically, it can get cleared by the user when IsEditable is

true and IsReadOnly is false. In this case, if the user changes the selection box text to

something that doesn’t match any item, the SelectionChanged event is raised with an

empty AddedItems collection.

WPF Interview Questions ,How can I forcibly close a ToolTip that is currently showing?


WPF Interview Questions ,How can I forcibly close a ToolTip that is currently showing?




Set its IsOpen property to false.

WPF Interview Questions ,How do I get a ToolTip to appear when hovering over a disabled element?



Use the ShowOnDisabled attached property of the ToolTipService class! From

XAML, this would look like the following on a Button:

Or from C# code, you can call the static method corresponding to the attached property:

ToolTipService.SetShowOnDisabled(myButton, true);



WPF Interview Questions ,When should I use WPF instead of Adobe Flash?



For creating rich web content, Flash is currently the most popular option because of its ubiquity.

You can put Flash-based content on a website with confidence that the overwhelming

majority of visitors already have the necessary player installed. (And if they don’t, it’s a very

quick download.) WPF applications can also run within a web browser. WPF has the advantage of better development tools and programming model, a richer feature set, robust control reuse, broad programming language support, and full access to the underlying platform (when security

permits). But viewing such content requires Windows and the .NET Framework 3.0 (installed

by default on Windows Vista or later).

WPF Interview Questions ,When should I use WPF instead of Windows Forms?



WPF is clearly more suitable for applications with rich media, but some people have said that Windows Forms is the best choice for business applications with traditional user interfaces. I think this belief is based on first versions of WPF in which many standard controls didn’t exist (such as TreeView, ListView, and OpenFileDialog) and a visual designer didn’t exist, making traditional Windows application development in WPF harder than in Windows Forms. Although Windows Forms still has useful controls that WPF lacks (such as DataGridView and PropertyGrid) and at the time of writing has a larger set of third-party controls in the marketplace, WPF has compelling features even for traditional user interfaces (such as the support for resolution independence or advanced layout).



WPF Interview Questions ,When should I use WPF instead of DirectX?



DirectX is definitely not dead and is still more appropriate than WPF for advanced developers writing hard-core “twitch games” or applications with complex 3D models where you need maximum performance. That said, it’s easy to write a naive DirectX application that performs far worse than a similar WPF application. DirectX is a low-level interface to the graphics hardware that exposes all of the quirks of whatever GPU a particular computer has. DirectX can be thought of as assembly language in the world of graphics: You can do anything the GPU supports. WPF provides a high-level abstraction that takes a description of your scene and

figures out the best way to render it, given the hardware resources available. Internally, this

might involve using Shader Model 3.0, or the fixed-function pipeline, or software. (Don’t worry if you’re not familiar with these terms, but take it as a sign that you should be using WPF!).

The downside of choosing DirectX over WPF is a potentially astronomical increase in development cost. A large part of this cost is the requirement to test your application on each

driver/GPU combination you intend to support. One of the major benefits of building on top of WPF is that Microsoft has already done this testing for you! You can instead focus your

testing on low-end hardware for measuring performance. The fact that WPF applications can

even leverage the client GPU over Remote Desktop or in a partial-trust environment is also a

compelling differentiator.

WPF Interview Questions ,What is the difference between Navigation applicaton and XBAPs in WPF?



While both are page-based applications. Navigation Page application are used for navigation applicated hosted with full trust policy that makes them ideal for deployment in secure environment. XBAPs are generally design for Window Explorer and are not locally installed. They are partial trust application restricted to use local file system, Database, registries and other sensitive resources and this makes them ideal for wide distribution

Entry Level

• Strong .NET 2.0 Background & willing to learn!

• Explain dependency properties?

• What’s a style?

• What’s a template?

• Binding

• Differences between base classes: Visual, UIElement, FrameworkElement, Control

• Visual vs Logical tree?

• Property Change Notification (INotifyPropertyChange and ObservableCollection)

• ResourceDictionary – Added by a7an

• UserControls – Added by a7an

• difference between bubble and tunnel routing strategies – added by Carlo

Mid-level

• Routed Events & Commands

• Converters – Added by Artur Carvalho

• Explain WPF’s 2-pass layout engine?

• How to implement a panel?

• Interoperability (WPF/WinForms)

• Blend/Cider – Added by a7an

• animations and storyboarding

• ClickOnce Deployment

• Skinning/Themeing

• Custom Controls

• How can worker threads update the UI?

Senior

• Example of attached behavior?

• What is PRISM,CAL & CAG?

• How can worker threads update the UI?

• WPF 3D – Added by a7an

• Differences between Silverlight 2 and WPF

• MVVM/MVP – Added by a7an

• WPF Performance tuning

• Pixel Shaders

• Purpose of Freezables

WPF Interview Questions ,What are the three kinds of routed events in WPF and how do they differ?



Routed events in WPF are direct, tunneling a bubbling. A direct event can be raised only by the element in which it originated. A bubbling event is raised first by the element in which it originates and then is raised by each successive container in the visual tree. A tunneling event is raised first by the topmost container in the visual tree and then down through each successive container until it is finally raised by the element in which it originated. Tunneling and bubbling events allow elements of the user interface to respond to events raised by their contained elements.

WPF Interview Questions ,What is observableCollection in WPF?



In many cases the data that you work with is a collection of objects. For example, a common scenario in data binding is to use anItemsControl such as a ListBox, ListView, or TreeView to display a collection of records. You can enumerate over any collection that implements the IEnumerable interface. However, to set up dynamic bindings so that insertions or deletions in the collection update the UI automatically, the collection must implement the INotifyCollectionChanged interface. This interface exposes the CollectionChanged event, an event that should be raised whenever the underlying collection changes.

WPF provides the ObservableCollection(T) class, which is a built-in implementation of a data collection that implements theINotifyCollectionChanged interface. Before implementing your own collection, consider using ObservableCollection(T) or one of the existing collection classes, such as List(T),Collection(T), and BindingList(T), among many others. If you have an advanced scenario and want to implement your own collection, consider using IList, which provides a non-generic collection of objects that can be individually accessed by index. Implementing IList provides the best performance with the data binding engine.



WPF Interview Questions ,What is BAML?

BAML, which stands for Binary Application Markup Language, is simply XAML that has been parsed, tokenized, and converted into binary form. Although any chunk of XAML can be represented by procedural code, the XAML-to-BAML compilation process does not generate procedural source code. So, BAML is not like Microsoft intermediate language (MSIL); it is a compressed declarative format that is faster to load and parse (and smaller in size) than plain XAML. BAML is just an implementation detail of the XAML compilation process without any direct public exposure, so it could be replaced with something different in the future. Nevertheless, it’s interesting to be aware of its existence.

WPF Interview Questions ,What is XBAP?


XBAP stands for XAML Browser Application. XBAP allows for WPF applications to be used inside a browser. The .NET framework is required to be installed on the client system. Hosted applications run in a partial trust sandbox environment. They are not given full access to the computer’s resources and not all of WPF functionality is available.WPF supports the creation of applications that run directly in a web browser. (So will WPF/E, when it is released.) They are called XAML Browser Applications (XBAPs), and have a .xbap file extension.

The power of this WPF support is that the exact same programming model is used for a XAML Browser Application as for a standard Windows application. Therefore, creating an XBAP isn’t much different than creating a standard Windows application. The maindifferences are as follows:

• Not all features in WPF or the .NET Framework are accessible (by default).

• Navigation is integrated into the browser (for Internet Explorer 7 or later).

• Deployment is handled differently.

WPF Interview Questions ,What kind of documents are supported in WPF?


There are two kind of major document supported in WPF Fixed format documents and Flow format document. Fixed format documents look like PDF format. They display content regardless of screen size and resolution. But flow format document adjust depending on screen size and resolution.

Below is the code snippet for fixed format. You can see the document has a look of PDF reader. Step 1 defines the tag to define a document and Step 2 shows how the document looks.

WPF Interview Questions :Can you explain how we can separate code and XAML?



This is one of the most important features of WPF, separating the XAML from the code to be handled. So designers can independently work on the presentation of the application and developers can actually write the code logic independent of how the presentation is.

WPF Interview Questions ,Are XAML file compiled or built on runtime?

WPF Interview Questions ,Are XAML file compiled or built on runtime?
XAML files are usually compiled rather than parsing on runtime. But it also supports parsing during runtime. When we build a XAML based project, you will see it creates g.cs extension in obi\Debug folder. Therefore, for every XAMl file you will find a g.cs file. For instance, a Shiv.XAML will have Shiv.g.cs file in obi\Debug folder. In short, in runtime you actually do not see the XAML file. But if you want to do runtime, parsing of XAML file it also allows that to be done.

WPF Interview Questions ,What are dependency properties?

WPF Interview Questions ,What are dependency properties?


These dependency properties belong to one class but can be used in another.

Consider the below code snippet:-


Height and Width are regular properties of the Rectangle. But Canvas. Top and Canvas. Left is dependency property as it belongs the canvas class. It is used by the Rectangle to specify its position within Canvas.

WPF Interview Questions,What is XAML?

XAML (pronounced as Zammel) is a declarative XML-based language by which you can define object and properties in XML. XAML document is loaded by a XAML parser. XAML parser instantiates objects and set there properties. XAML describes objects, properties and there relation in between them. Using XAML, you can create any kind of objects that means graphical or non-graphical. WPF parses the XAML document and instantiates the objects and creates the relation as defined by XAML.


So XAML is a XML document which defines objects and properties and WPF loads this document in actual memory

WPF Interview Questions important namespaces / classes in WPF(.NET)

1.System.Threading.DispatcherObject

All WPF objects derive from the DispatcherObject. WPF works on STA model i.e. Single Threading Apartment Model. The main duty of this object is to handle concurrency and threading. When any message like mouse clicks, button clicks etc are initiated they are sent to the DispatcherObject who verifies whether code is running on the correct thread. In the coming section we will look in to detail how WPF threading works.

2.System.Windows.DependencyObject

When WPF was designed property based architecture was considered. In other words rather than using methods, functions and events object behavior will interact using properties. For now we will only restrict ourselves to this definition. In the coming section we have dedicated question for the same.

3.System.Windows.Media.Visual


Visual class is a drawing object which abstracts drawing instructions, how drawing should be drawn like clipping, opacity and other functionalities. Visual class also acts like a bridge between unmanaged MilCore.dll and WPF managed classes. When any class derived from visual it can be displayed on windows. If you want to create your own customized user interface then you can program using visual objects.

4.System.Windows.UIElement

UIElement handled three important aspects layout, input and events.

System.Windows.FrameworkElement

FrameWorkElement uses the foundation set by UIElement. It adds key properties like HorizontalAlignment , VerticalAlignment , margins etc.

5.System.Windows.Shapes.Shape


This class helps us to create basic shapes such as Rectangle, Polygon, Ellipse, Line, and Path.

6.System.Windows.Controls.Control

This class has controls like TextBox,Button,ListBox etc. It adds some extra properties like font,foreground and background colors.

7.System.Windows.Controls.ContentControl

It holds a single piece of content. This can start from a simple label and go down to a unit level of string in a layout panel using shapes.

System.Windows.Controls.ItemsControl

This is the base class for all controls that show a collection of items, such as the ListBox and TreeView.

8.System.Windows.Controls.Panel


This class is used for all layout containers—elements that can contain one or more children and arrange them as per specific layout rules. These containers are the foundation of the WPF layout system, and using them is the key to arranging your content in the most attractive, flexible way possible.

Sunday, January 23, 2011

What type of polymerization will take place in manufacturing of LDPE(Low Density PolyEthylene)?(Properties,Thermoplastic)

LDPE is aemi-rigid material, and was the first of the ployethylenes to be developed. Most commonly addition polymerization is used  in manufacturing of LDPE(Low Density PloyEthylene).

Low-density polyethylene (LDPE) is a thermoplastic made from petroleum. It was the first grade of polyethylene, produced in 1933 by Imperial Chemical Industries (ICI) using a high pressure process via free radical polymerization.

Applications

LDPE is widely used for manufacturing various containers, dispensing bottles, wash bottles, tubing, plastic bags for computer components, and various molded laboratory equipment. Its most common use is in plastic bags. Other products made from it include:

Trays and general purpose containers

Food storage and laboratory containers

Corrosion-resistant work surfaces

Parts that need to be weldable and machinable

Parts that require flexibility, for which it serves very well

Very soft and pliable parts

Six pack rings

Juice and milk cartons, whose "cardboard" is actually liquid packaging board, a laminate of paperboard and LDPE (as the water-proof inner and outer layer), and often with of a layer of aluminum foil (thus becoming aseptic packaging).
Parts of computer hardware, such as hard disk drives, screen cards, and optical disc drives

Playground slides

Plastic wraps

Properties
 
LDPE is defined by a density range of 0.910–0.940 g/cm³. It is not reactive at room temperatures, except by strong oxidizing agents, and some solvents cause swelling. It can withstand temperatures of 80 °C continuously and 95 °C for a short time. Made in translucent or opaque variations, it is quite flexible, and tough but breakable.
 

Draw the inclined manometer diagram?

Inclined manometer can be constructed in many ways according to our purpose.

Most common one is as shown in the diagram,



An inclined manometer is used to measure very small pressures,vacuums, or differentials. The slanted scale enables reading 0.01"wc variations, which is impossible with conventional manometers or gauges.





Pressure drop equation for horizontal pipe line in laminar flow condition?

 In fluid dynamics, the Hagen–Poiseuille equation is a physical law that gives the pressure drop in a fluid flowing through a long cylindrical pipe. The assumptions of the equation are that the flow is laminar viscous and incompressible and the flow is through a constant circular cross-section that is substantially longer than its diameter. The equation is also known as the Hagen–Poiseuille law, Poiseuille law and Poiseuille equation.

The governing equation is,


Monday, January 10, 2011

Laws of resistance(Resistivity ,specific resistance )

 Laws of resistance

The resistance of a wire depends upon its length, area of cross section, type of material,purity and hardness of  material of which it is made of and the operating temperature.

Resistance of a wire is 

  1. Directly proportional to its length, l i.e R α l
  2. Inversely proportional to its area of cross section, a i.e Rα 1/a
 Combining above two facts we have R α l/a


where ρ is a constant depending upon the nature of the material and is known as the specific resistance or resistivity of teh amterial of the wire.

Resistivity or specific resistance of amaterial may also be defined as the resistance of the material of unit length and unit cross section area.

Specific resistance or resistivity of a material may also defined as the resistance of the material may also defined as the resistance between opposite faces of a unit cube of that material.
Resistivity is measured in ohm-metres Ω-m or ohms per meter cube

For More Details about Ohm's Law See the Video 







Conductance and Conductivity

Current Density

Types of Current Supply

Conductors insulators and semiconductors



Thermal conductivity calculations, experiments, molecular simulations

Nowadays various experimental procedures are there to calculate the thermal conductivity of various materials using various techniques. Th...

About Me

COTACT: studymaterialforall@gmail.com