Stem Class
Definition
Provides a way to support assigning a stem to a value.
public sealed class Stem
- Inheritance
-
Stem
Examples
The following example demonstrates how to use Stem to build a URL path by attaching prefixes and suffixes without duplication.
using Cuemon.Text;
namespace MyApp.Examples;
public class StemExample
{
public void Demonstrate()
{
var path = new Stem("api")
.AttachPrefix("/")
.AttachSuffix("/")
.AttachSuffix("v1")
.AttachSuffix("/")
.AttachSuffix("users");
var result = path.ToString();
// result == "/api/v1/users"
}
}
Constructors
| Name | Description |
|---|---|
| Stem(string) | Initializes a new instance of the Stem class. |
Properties
| Name | Description |
|---|---|
| Value | Gets the value of this instance. |
Methods
| Name | Description |
|---|---|
| AttachPrefix(string) | Attaches the specified |
| AttachPrefix(string, Func<string, bool>) | Attaches the specified |
| AttachSuffix(string) | Attaches the specified |
| AttachSuffix(string, Func<string, bool>) | Attaches the specified |
| ToString() | Returns a string that represents the current object. |
Operators
| Name | Description |
|---|---|
| implicit operator string(Stem) | |
| implicit operator Stem(string) |