Skip to main content

Chaining Methods - C# Intermediate Tutorials

CHAINING METHODS IN C#

INTERMEDIATE TUTORIAL

by Chamuth Chamandana



What are Chaining Methods?

=======================

Chaining Methods are used in C# in many ways. In extension methods and extension libraries such as LINQ, we use Chaining methods to pass the modified variable to the next method.



Example (built-in methods):

var result = "Hello World".Replace("World", "Chamuth").ToLower().Substring(5);



What we're going to talk about in this video

==================================

We're making a class known as StringDeveloper which creates strings from adding other strings which implements Chaining functionality. Which means every method returns itself, the context using return this; statement at the end of the changing of the content of the object which lets us call other functions in the object/class after.



Chaining Methods are also available in every other programming language including C, Java, JavaScript and etc.



Let me know what you want to know more about, in the comments section. If you enjoy please Subscribe to my channel and encourage us by liking our videos!!!



Comments

Popular posts from this blog

Animating Objects in WPF using Code Behind (C#)

A Feature that is built in to the WPF Platform is the ability to animate content without using Timers. That is inside the System.Windows.Media.Animation namespace. In this video, I'm going to help you with creating animations using the code behind (C#)

ඔබට අවශ්‍ය වන Keyboard Shortcuts කිහිපයක්

CTRL + x Cut Selected CTRL + c Copy Selected CTRL + v Paste data CTRL + z Undo CTRL + y Redo CTRL + a Select All F1 Help Shortcut F2 Rename Selected F4 Switch to URL Mode in Windows Explorer F5 Refresh F11 Full Screen Windows Explorer START + TAB Switch Windows in Windows 7 + Task View in Windows 10 START + A Show Notifications in Windows 10 START + Q Cortana in Windows 10 START + E Start a new Explorer Window START + R Run Window START + U Ease of Access START + I Settings in Windows 10 START + P Project Display Options START + G Open Game Bar START + H Share Screenshot START + K Connect Devices START + L Lock Windows START + X Mobility Options START + C Cortana Quick Search Box START + M Show Desktop PRINTSCREEN / Print Screen SysRq Button Take a Screenshot and Copies it to Clipboard END select කරඇති වාක්‍යයේ අවසානයට පිවිසේ HOME Select කරඇති වාක්‍යයේ පටන්ගැන්මට යැවෙනු ඇත Page UP / DOWN Sele...

1 - Introduction to Sass and Variables | Sass Tutorials (SCSS)

This tutorial series at https://www.youtube.com/watch?v=upFW3wJoawk&t=1s&index=1&list=PLiugj09i4WUISuDdzEYu7FTCKWQhtO_lp will teach you how to use Sass in designing and developing your websites. We're going to be talking about, 1. Variables 2. Partials 3. Nesting 4. Mixins 5. Inheritance in this video. Please watch it till the end and share it if you like :D