{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "7bac486b",
   "metadata": {},
   "source": [
    "# Chapter Review\n",
    "\n",
    "1. After writing everything you want to a file through a `StreamWriter`,\n",
    "   what do you still need to remember to do?\n",
    "\n",
    "2. If you want to create a file path in an operating system independent way for\n",
    "   file f.txt in directory d2, which is a subdirectory of d1, which is a\n",
    "   subdirectory of the current directory, how would you do it?\n",
    "\n",
    "3. Windows uses `\\` as a path separator. If you want to write a literal\n",
    "   directly for a Windows path, what issue is there in C#?\n",
    "\n",
    "4. In a file path, how do you refer to the parent directory of the\n",
    "   current directory, without using the actual name of the parent directory?\n",
    "\n",
    "5. If you are reading from a `StreamReader` `inFile` (namely, for example, you wrote:\n",
    "   `StreamReader inFile = new StreamReader(path))`), what is logically\n",
    "   wrong with the following:\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "   if (inFile.ReadLine().Contains(\"!\")) {\n",
    "      Console.WriteLine(inFile.ReadLine() + \"\\n contains the symbol !\")\n",
    "   }\n"
   ],
   "id": "39b58c8e"
  },
  {
   "cell_type": "markdown",
   "id": "0aae5455",
   "metadata": {},
   "source": "# Chapter Review"
  },
  {
   "cell_type": "markdown",
   "id": "f6ec4a32",
   "metadata": {},
   "source": "## Key takeaways\n\n- Clean text before parsing.\n- Validate structure before converting types.\n- Use `TryParse` for robust conversion.\n- Handle malformed lines without crashing.\n- Keep original text when doing replacements."
  },
  {
   "cell_type": "markdown",
   "id": "d8b2924c",
   "metadata": {},
   "source": "## Review questions\n\n1. What is the difference between text normalization and parsing?\n2. Why should `TryParse` be preferred over `Parse` for user/file input?\n3. What checks should occur before indexing `parts[2]` after `Split(',')`?\n4. Why is preserving the original line useful during cleanup?"
  },
  {
   "cell_type": "markdown",
   "id": "727f8c6a",
   "metadata": {},
   "source": "## Practice prompt\n\nWrite a method that accepts one CSV-like line and returns:\n\n- whether parsing succeeded\n- normalized name\n- parsed score\n\nUse `out` parameters and do not throw on malformed input."
  }
 ],
 "metadata": {
  "jupytext": {
   "cell_metadata_filter": "-all",
   "main_language": "python",
   "notebook_metadata_filter": "-all"
  },
  "kernelspec": {
   "display_name": ".NET (C#)",
   "language": "C#",
   "name": ".net-csharp"
  },
  "language_info": {
   "name": "csharp"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}