Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ I am Jane Doe!
```csharp
Person person = new Person
{
Name = "John Doe",
MyCars = new List<Car>
{
new Car { Make = "BMW", Year = 2023 },
Expand All @@ -81,7 +80,6 @@ Person person = new Person
};

string template = @"
{{ Name }}'s Cars
{{ #foreach(MyCars) }}
- {{ Year }} {{ Make }}
{{ #endforeach }}";
Expand All @@ -93,13 +91,37 @@ Console.WriteLine(result);

**Output:**
```
John Doe's Cars
- 2023 BMW
- 2020 Rolls-Royce
```
---

### Example 4: Number Formatting Support
### Example 4: Conditional Logic with `#if`, `#else`, and `#endif`

```csharp
Person person = new Person
{
Age = 40
};

string template = @"
{{ #if(Age >= 18) }}
Adult
{{ #else }}
Minor
{{ #endif }}";

string result = person.Map(template);

Console.WriteLine(result);
```

**Output:**
```
Adult
```
---
### Example 5: Number Formatting Support

```csharp
Car car = new Car
Expand Down