Skip to content

Wiki Contributions

axunonb edited this page Jul 20, 2025 · 1 revision

📚 Contributing to iCal.NET Wiki

Our goal is to create high-quality wiki samples that help users understand how to use the iCal.NET library effectively.

We encourage contributions that transform test code into user-friendly wiki samples. The following guidelines will help maintain consistency and clarity across the wiki.


1. Purpose and Audience

  • The wiki should help users understand how to use the library, not just show test code.
  • Aim for clarity, simplicity, and real-world relevance.

2. Structure for Wiki Samples

Use the following structure for each wiki code sample:

  1. Short Description
    Briefly explain what the sample demonstrates and why it matters.

  2. Code Block
    Provide a minimal, self-contained code snippet.

    • Remove test framework code (e.g., [Test], Assert.That).
    • Use comments to explain key lines.
  3. Expected Output
    Show the result (e.g., serialized string, occurrence dates) as plain text.

  4. Further Reading
    Optionally, and if it helps to better understand, link to the relevant test file for more advanced scenarios.


Example Transformation

Test Code:

We should place the test code in a more user-friendly format for the wiki. Here’s how to transform the provided test code into a wiki sample:

[Test]
public void WikiExample()
{
    // ... setup ...
    Assert.That(calendarAsIcs, Is.Not.Null);
    // ... more asserts ...
}

In the iCal.NET project folder Ical.Net.Tests there is a folder WikiSamples where all wiki test code gets stored. This ensures that changes to iCal.NET do not break the wiki samples.

Wiki Sample:

// Create a daily recurring event, every 2 days, 2 times
var start = new CalDateTime(2025, 07, 10, 09, 00, 00, "Europe/Zurich");
var recurrence = new RecurrencePattern
{
    Frequency = FrequencyType.Daily,
    Interval = 2,
    Count = 2
};

var calendarEvent = new CalendarEvent
{
    DtStart = start,
    DtEnd = start.AddHours(1),
    RecurrenceRules = new[] { recurrence }
};

var calendar = new Calendar();
calendar.Events.Add(calendarEvent);

var calendarSerializer = new CalendarSerializer();
var calendarAsIcs = calendarSerializer.SerializeToString(calendar);
Console.WriteLine(calendarAsIcs);

Expected Output:

BEGIN:VCALENDAR
BEGIN:VEVENT
DTEND;TZID=Europe/Zurich:20250710T100000
DTSTART;TZID=Europe/Zurich:20250710T090000
RRULE:FREQ=DAILY;INTERVAL=2;COUNT=2
END:VEVENT
END:VCALENDAR

3. General Guidelines

  • Avoid test-specific code (e.g., assertions, test attributes).
  • Explain the intent of the sample in plain language.
  • Keep code minimal—remove unrelated setup or utilities.
  • Show both code and output for clarity.
  • Link to tests for advanced or edge cases, but keep the wiki focused on learning.

4. Sample Wiki Template

### [Short Title]

**Description:**  
[What does this sample do? Why is it useful?]

**Code:**

// [Sample code here]

**Output:**

[Expected output here]

**See also:**  
- [Link to further examples]

Clone this wiki locally