Reader small image

You're reading from  .NET Design Patterns

Product typeBook
Published inJan 2017
Reading LevelIntermediate
PublisherPackt
ISBN-139781786466150
Edition1st Edition
Languages
Tools
Right arrow
Authors (2):
Praseed Pai
Praseed Pai
author image
Praseed Pai

Praseed Pai has been working in the software industry for the last 25 years, starting his career as a MS-DOS systems programmer using ANSI C. He has been actively involved in developing large-scale, cross-platform, native code-based systems using C++ on Windows, GNU Linux, and macOS X. He has experience in COM+ and CORBA programming using C++. In the last decade, he has worked with Java- and .NET-based systems. He is the primary implementer of the SLANG4.net compilation system, which has been ported to C++ with an LLVM backend. He coauthored .NET Design Patterns, by Packt Publishing.
Read more about Praseed Pai

Shine Xavier
Shine Xavier
author image
Shine Xavier

Shine Xavier is a core software engineering practitioner with an extreme passion for designing/building software solutions, application frameworks, and accelerators that help maintain productivity, code quality, performance, and security. His areas of interest include functional programming, interpreters, JavaScript library development, visual programming, algorithms, performance engineering, automation, enterprise mobility, IoT and machine learning. He is currently associated with UST Global as a senior architect, where he continues to provide technical leadership in customer engagements, pre-sales, practice development, product development, innovation, and technology adoption. He lives with his wife and three kids in Thiruvananthapuram, Kerala, India.
Read more about Shine Xavier

View More author details
Right arrow

Strategy pattern in the .NET BCL


The strategy pattern (aka policy pattern) is a design pattern where we can choose algorithms depending upon the context. The pattern is intended to provide a means to define a family of algorithms encapsulated as an object to make them interchangeable. The strategy pattern lets the algorithms vary independently from the clients that use them.

The Array and the ArrayList classes provide the capability to sort objects contained in them through the Sort method. One can use different strategies to sort by leveraging the strategy design pattern-based API provided by the .NET BCL. The designers of .NET Framework have given us the IComparer<T> interface to provide a sorting strategy. Array and ArrayList provide the capability to sort the objects contained in the collection via the Sort method. Strategy design pattern is used with Array and Arraylist to enable sorting using different strategies, without changing any client code, via an IComparable interface...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
.NET Design Patterns
Published in: Jan 2017Publisher: PacktISBN-13: 9781786466150

Authors (2)

author image
Praseed Pai

Praseed Pai has been working in the software industry for the last 25 years, starting his career as a MS-DOS systems programmer using ANSI C. He has been actively involved in developing large-scale, cross-platform, native code-based systems using C++ on Windows, GNU Linux, and macOS X. He has experience in COM+ and CORBA programming using C++. In the last decade, he has worked with Java- and .NET-based systems. He is the primary implementer of the SLANG4.net compilation system, which has been ported to C++ with an LLVM backend. He coauthored .NET Design Patterns, by Packt Publishing.
Read more about Praseed Pai

author image
Shine Xavier

Shine Xavier is a core software engineering practitioner with an extreme passion for designing/building software solutions, application frameworks, and accelerators that help maintain productivity, code quality, performance, and security. His areas of interest include functional programming, interpreters, JavaScript library development, visual programming, algorithms, performance engineering, automation, enterprise mobility, IoT and machine learning. He is currently associated with UST Global as a senior architect, where he continues to provide technical leadership in customer engagements, pre-sales, practice development, product development, innovation, and technology adoption. He lives with his wife and three kids in Thiruvananthapuram, Kerala, India.
Read more about Shine Xavier