@@ -13,7 +13,32 @@ Var bob2 = alice with { }
13
13
var alice2 = new Person ("Alice", 30);
14
14
Console.WriteLine(alice == alice2); // Output: True (values are equal)
15
15
```
16
+ ## Service class
17
+ ```
18
+ namespace XYZ;
19
+
20
+ public sealed class MyService
21
+ {
22
+ public MyService(ILogger<MyService> logger)
23
+ {
24
+ _logger = logger;
25
+ }
16
26
27
+ private readonly ILogger _logger;
28
+
29
+ public void MyAction()
30
+ {
31
+ try
32
+ {
33
+ _logger.LogDebug("My Action called");
34
+ }
35
+ catch(Exception ex)
36
+ {
37
+ ExceptionHelper.Log(ex);
38
+ }
39
+ }
40
+ }
41
+ ```
17
42
## Pattern Matching
18
43
```
19
44
// is expression
@@ -474,4 +499,73 @@ usage
474
499
@inject IJSRuntime JS
475
500
JS.ConsoleLog("Hello");
476
501
JS.NavigateBack();
502
+ ```
503
+
504
+ ## HTML 5
505
+ ```
506
+ <!DOCTYPE html>
507
+ <html lang="en">
508
+ <head>
509
+ <meta charset="UTF-8">
510
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
511
+ <title>Document Title</title>
512
+ <!-- Add your CSS links here -->
513
+ <!-- <link rel="stylesheet" href="styles.css"> -->
514
+ </head>
515
+ <body>
516
+ <!-- Your content goes here -->
517
+
518
+ <!-- Add your JavaScript links here -->
519
+ <!-- <script src="script.js"></script> -->
520
+ </body>
521
+ </html>
522
+ ```
523
+
524
+ ## razor component
525
+ ```
526
+ @page "/mypage/{Id}"
527
+ @page "/anotherPath"
528
+
529
+ @layout StandardPageLayout
530
+
531
+ @inject ILogger<MyPage> Logger
532
+ @inject IJSRuntime JS
533
+ @inject NavigationManager NM
534
+
535
+ <div>
536
+ </div>
537
+
538
+ @code {
539
+
540
+ [Parameter]
541
+ public string Id { get; set; }
542
+
543
+ protected override async Task OnInitializedAsync()
544
+ {
545
+ try
546
+ {
547
+ await base.OnInitializedAsync();
548
+ }
549
+ catch(Exception ex)
550
+ {
551
+ ExceptionHelper.Log(ex);
552
+ }
553
+ }
554
+
555
+ protected override async Task OnAfterRenderAsync(bool first)
556
+ {
557
+ try
558
+ {
559
+ if (first)
560
+ {
561
+
562
+ }
563
+ await base.OnAfterRenderAsync(first);
564
+ }
565
+ catch(Exception ex)
566
+ {
567
+ ExceptionHelper.Log(ex);
568
+ }
569
+ }
570
+ }
477
571
```
0 commit comments