Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
.NET Design Patterns

You're reading from   .NET Design Patterns Learn to Apply Patterns in daily development tasks under .NET Platform to take your productivity to new heights.

Arrow left icon
Product type Paperback
Published in Jan 2017
Publisher Packt
ISBN-13 9781786466150
Length 314 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Praseed Pai Praseed Pai
Author Profile Icon Praseed Pai
Praseed Pai
Shine Xavier Shine Xavier
Author Profile Icon Shine Xavier
Shine Xavier
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Preface 1. An Introduction to Patterns and Pattern Catalogs FREE CHAPTER 2. Why We Need Design Patterns? 3. A Logging Library 4. Targeting Multiple Databases 5. Producing Tabular Reports 6. Plotting Mathematical Expressions 7. Patterns in the .NET Base Class Library 8. Concurrent and Parallel Programming under .NET 9. Functional Programming Techniques for Better State Management 10. Pattern Implementation Using Object/Functional Programming 11. What is Reactive Programming? 12. Reactive Programming Using .NET Rx Extensions 13. Reactive Programming Using RxJS 14. A Road Ahead

Builder pattern in the .NET BCL


The builder pattern is a creational pattern, which separates the construction of a complex object from its representation. Usually, it parses a complex representation to create one or more target objects. Most often, builders create composites. In the System.Data.SqlClient namespace, SqlConnectionStringBuilder helps one build connection strings for the purpose of connecting to an RDBMS engine:

    SqlConnectionStringBuilder builder = new   
    SqlConnectionStringBuilder(); 
    builder["Data Source"] = "(local)"; 
    builder["integrated Security"] = true; 
    builder["Initial Catalog"] = "AdventureWorks;NewValue=Bad"; 
    Console.WriteLine(builder.ConnectionString); 

The .NET BCL also contains a class that will help us create a URI by assembling its constituents. The following code snippet creates a secured HTTP (https) URL, which sends data to port 3333:

    var builder = new UriBuilder(url); 
    builder.Port = 3333 ...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image