You are previewing Visual Studio 2012 and .NET 4.5 Expert Development Cookbook.
O'Reilly logo
Visual Studio 2012 and .NET 4.5 Expert Development Cookbook

Book Description

Put Visual Studio and .NET together and the results are empowering. With over 40 recipes in this Cookbook you can learn to integrate them both to achieve unparalleled results in applications that are in tune with modern technologies.

  • Step-by-step instructions to learn the power of .NET development with Visual Studio 2012

  • Filled with examples that clearly illustrate how to integrate with the technologies and frameworks of your choice

  • Each sample demonstrates key conceptsto build your knowledge of the architecture in a practical and incremental way

  • In Detail

    Working with a varied set of upcoming technologies is a challenge. Visual Studio 2012 is all about enabling you to develop and manage these consumer-focused and business-focused apps. It provides best-in-class tools that propel developers to create new apps or evolve existing ones, and it enables individuals and teams to deliver continuous value and agility. In conjunction, .NET 4.5 provides expansive capabilities for developers to work on all forms of apps and services, from client to mobile to web to cloud, enabling them to get to the market fast. This book shows you exactly how to do this, and much more. It focuses on giving expertise on upcoming technologies through complete architectural insights of .NET infrastructure and hands on examples.

    "Visual Studio 2012 and .NET 4.5 Expert Development Cookbook" is a step-by-step practical guide that teaches you how to work with new changes on technology under .NET. It provides in-depth analysis and expert advice on various elements of .NET, applying them in code using detailed practical examples. The book provides solutions to common development problems and helps you adapt to the latest technologies and get to grips with modern app development for the .NET 4.5 platform.

    This cookbook gets you startedon Visual Studio 2012 IDE and its various tooling capabilities. It provides expert knowledge on .NET infrastructure, internals of assemblies, and a basic introduction of Intermediate language. Common C# concepts and ideas are demonstrated through an example-driven approach.

    The recipes provide an overall view of ASP.NET Web applications and introduce the new performance boosters in .NET 4.5. It also gives a basic introduction to HTML 5 and JQuery library to enhance Web applications. It provides a complete introduction to Client applications using WPF and MVVM patterns and looks at some of the major enhancements on WPF 4.5. It shows you how to write applications for Windows 8 and provides expert advice on how to write applications in WinRT, either using XAML and C# or HTML/JavaScript.

    "Visual Studio 2012 and .NET 4.5 Expert Development Cookbook" gives you better understanding of overall .NET infrastructure using the latest technology updates, providing a broad guide for a basic developer to become an expert on .NET.

    Table of Contents

    1. Visual Studio 2012 and .NET 4.5 Expert Development Cookbook
      1. Table of Contents
      2. Visual Studio 2012 and .NET 4.5 Expert Development Cookbook
      3. Credits
      4. About the Authors
      5. Acknowledgement
      6. About the Reviewers
      7. www.PacktPub.com
        1. Support files, eBooks, discount offers and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
          3. Instant Updates on New Packt Books
      8. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      9. 1. Introduction to Visual Studio IDE Features
        1. Introduction
          1. Evolution of Visual Studio
        2. Identifying the various components of Visual Studio IDE
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more...
            1. Visual Studio command switches
        3. Working with Solution Explorer and Class View
          1. How to do it…
          2. How it works…
          3. There's more...
            1. Previewing images in Solution Explorer
            2. Different IDE editors
        4. Working with the main workspace area of IDE
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Docking windows inside the IDE workspace
            2. Search IDE features
            3. Preview files in IDE
        5. Navigating between code inside the IDE
          1. How to do it…
          2. How it works…
          3. There's more...
            1. Architecture Explorer
            2. Sequence diagrams
            3. Task List
            4. Bookmark menu
            5. The Code Definition window
            6. Extension Manager
            7. What is MSBuild and how can I use it?
            8. Debugging the application
          4. See also
        6. Extending Visual Studio templates
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Adding custom parameters
            2. Creating a template with more than one project
          4. See also
        7. Using Code Snippets in Visual Studio
          1. How to do it…
          2. How it works...
          3. There's more…
            1. Organizing Usings
            2. Outlining
            3. Using the Toolbox
        8. Using Smart Tags and Refactor in Visual Studio
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Clone Code Detection
          4. See also
      10. 2. Basics of .NET Programs and Memory Management
        1. Introduction
        2. Inspecting the internal structure of a .NET assembly
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Inspecting by using an assembly viewer
        3. Working with different types of assemblies
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Creating a friend assembly
            2. How to delay sign an assembly
            3. How to share a private assembly between more than one application
            4. How to use the Global Assembly Cache tool
        4. Inspecting the major components of a .NET program
          1. How to do it...
          2. How it works...
            1. Entry point
            2. The AssemblyInfo file
            3. The application manifest file
            4. The application configuration file
          3. There's more...
        5. How to work with custom configurations for an application
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more…
            1. How to change the configuration of an application at runtime
            2. How to deal with configuration versions
        6. How to disassemble an assembly
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. How to disassemble an assembly using Reflector
            2. How to merge assemblies into one
            3. What is IL Weaving
        7. Securing your code from reverse engineering by using obfuscation
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Using different additional options on Dotfuscator
            2. Configuring an assembly directly from Visual Studio
            3. Obfuscation using
        8. Understanding .NET garbage collection and memory management
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. The effect of finalizer on garbage collection
            2. Optimizing native images using Managed Profile Guided Optimization
            3. Multicore JIT
          5. See also
        9. How to find memory leaks in a .NET program
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. What are weak references in .NET
            2. What are lazy objects in .NET
              1. Lazy
              2. ThreadLocal
              3. LazyInitializer
            3. How to use Visual Studio to create memory dump files
            4. How to isolate code using AppDomain
        10. Solutions to 10 common mistakes made by developers while writing code
          1. Getting ready
          2. How to do it...

          3. How it works...
          4. There's more...
            1. Never declare structs if you don't have good reason to
            2. Do not create a list from IEnumerable before iterating on it
          5. See also…
      11. 3. Asynchronous Programming in .NET
        1. Introduction
        2. Introduction to Threading and Asynchronous Threading patterns
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Relation between a Process, AppDomain, and Thread
            2. What is a Waithandle class and why is it important?
            3. How does the Barrier class in .NET work?
            4. What is SynchronizationContext?
          4. See also
        3. Working with Event-based asynchronous pattern and BackgroundWorker
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        4. Working with thread locking and synchronization
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. How to determine Mutex of a Thread?
                1. Use Mutex for Instance Count
            2. Locking using Spinlock
            3. ReaderWriterLock for non-blocking synchronization constructs
          5. See also
        5. Lock statement using task-based parallelism in concurrent programming
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. How to handle exceptions inside a Task?
            2. How to work with TPL without concurrency?
            3. How to create custom TaskScheduler?
            4. How to deal with PLINQ?
          5. See also
        6. Working with async and await patterns
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. How to write Async anonymous method or a lambda expression?
            2. Different awaitable methods
          5. See also
        7. Working with Task Parallel Library data flows
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. What are the configuration options available for TPL Data Flow blocks?
            2. How to link to one block to another for Target?
          5. See also
      12. 4. Enhancements to ASP.NET
        1. Introduction
        2. Understanding major performance boosters in ASP.NET web applications
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. How to configure the compilation of pages in ASP.NET websites
            2. What is unobtrusive validation
            3. Applying appSettings configuration key values
            4. DLL intern in ASP.NET servers
          5. See also
        3. How to work with statically-typed model binding in ASP.NET applications
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. ModelBinding with filter operations
          5. See also
        4. Introduction to HTML5 and CSS3 in ASP.NET applications
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. How to work with web workers in HTML5
            2. Working with Socket using HTML5
            3. Getting GeoLocation from the browser using HTML5
            4. Working with local IndexDB storage in a browser using HTML5
            5. Using application cache for a site in HTML5
            6. Detecting online status of the browser using HTML5
            7. Working with notifications in browsers using HTML5
          5. See also
        5. Working with jQuery in Visual Studio with ASP.NET
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Extending the jQuery library
          5. See also
        6. Working with task-based asynchronous HttpHandlers and HttpModules
          1. Getting ready
          2. How to do it...
          3. How it works...
        7. New enhancements to various Visual Studio editors
          1. Getting ready
          2. How to do it…
          3. There's more…
            1. Configuration changes in ASP.NET 4.5
          4. See also
      13. 5. Enhancements to WPF
        1. Introduction
          1. Device Independent Pixel (DPI)
          2. Built-in support for graphics and animation
          3. Redefine styles and control template
          4. Resource-based approach for every control
          5. New property system and binding capabilities
        2. Getting started with WPF and its major enhancements in .NET 4.5
          1. How to do it...
          2. How it works...
          3. There's more...
            1. What are Visual Trees and Logical Trees?
            2. What are RoutedEvents?
            3. What is DependencyObject?
        3. Building applications using MVVM pattern supported by WPF
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. What is DependencyProperty, and how to declare and use it?
            2. What are the attributes of Binding and use of Binding Expression?
            3. How to implement data validation blocks in MVVM?
            4. How to work with CollectionView using Live Shaping?
              1. Sorting
              2. Grouping
              3. Filtering
              4. Current Record Manipulation
              5. Live Shaping
          5. See also
        4. Using the Ribbon User Interface in WPF
          1. Getting ready
          2. How to do it...
          3. There's more...
            1. Special RibbonTooltip for Ribbon-based controls
            2. Specifying shortcut keys for ribbon controls
            3. How to use RibbonGallery inside the ribbon
        5. Using WeakEvent pattern in WPF
          1. How to do it...
          2. How it works...
          3. See also
      14. 6. Building Touch-sensitive Device Applications in Windows 8
        1. Introduction
        2. Building your first Windows 8 style tiles application using JavaScript, HTML5, and CSS
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. How to deal with the look and feel of Windows 8 style tiles application using JavaScript and CSS
            2. How to enable animation within a Windows 8 style tiles application using WinJS
            3. How does the event life cycle work in WinJS
        3. Writing a library for WinJS
          1. How to do it…
          2. See also
        4. Building your first Windows 8 style tiles application using C# and XAML
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. What are the layouts available for a Windows 8 style tiles applications
            2. How to implement animation in Windows 8 style tile applications
          5. See also
        5. Working with storage files in Windows 8 style tiles applications
          1. How to do it...
          2. How it works...
          3. There's more...
            1. How to work with the Settings charm for an application
            2. How to take pictures from the camera in a Windows 8 device
          4. See also
        6. Understanding the application life cycle of WinRT applications
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Launch of the application and splash screen
            2. How to package an application
          5. See also
      15. 7. Communication and Sharing using Windows 8
        1. Introduction
        2. How to enable app to app sharing inside a Windows 8 environment
          1. How to do it...
          2. How it works...
        3. Working with notification and services
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. How to authenticate a web service using Web Authentication Broker API
            2. How to implement Push notifications in a connected Windows 8 style tile application
            3. How to use Syndication API and AtomPub API for handling feeds in Windows 8 style application
              1. The AtomPub API
        4. How to perform background transfers of data in Windows 8 style tiles applications
          1. How to do it…
          2. How it works…
          3. See also
      16. Index