Skip to content

Commit 8c914fb

Browse files
committed
update
1 parent d16dba3 commit 8c914fb

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

README.md

+94
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,32 @@ Var bob2 = alice with { }
1313
var alice2 = new Person ("Alice", 30);
1414
Console.WriteLine(alice == alice2); // Output: True (values are equal)
1515
```
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+
}
1626
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+
```
1742
## Pattern Matching
1843
```
1944
// is expression
@@ -474,4 +499,73 @@ usage
474499
@inject IJSRuntime JS
475500
JS.ConsoleLog("Hello");
476501
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+
}
477571
```

0 commit comments

Comments
 (0)