Skip to content

Commit

Permalink
fix: failed to parse Markdown attributes; you may need to quote the v…
Browse files Browse the repository at this point in the history
…alues.
  • Loading branch information
yangzhenghan committed Oct 25, 2023
1 parent bb20e44 commit 6770c84
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions content/posts/Newtonsoft.NET 基本使用.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ TestJsonDeseClass des =

那么如果不想序列化/反序列化某个成员变量呢?

``` csharp {5}
``` csharp
using Newtonsoft.Json;

public class TestJsonDeseClass
Expand All @@ -62,7 +62,7 @@ public class TestJsonDeseClass

如果JSON字符串中的属性名字和定义的类中的成员名字不一样怎么办呢?怎样才能正确的给成员变量赋值呢?

```csharp {5}
```csharp
using Newtonsoft.Json;

public class TestJsonDeseClass
Expand All @@ -80,7 +80,7 @@ public class TestJsonDeseClass

当然这样也是可以的,不过需要我们给类添加构造方法,在构造方法中对成员赋值,不能再使用默认的构造方法,因为默认的构造方法不会对成员赋值,而外部也无法对成员赋值。在添加了构造方法后,Json.NET会自动调用类的构造方法。

``` csharp {9}
``` csharp
using Newtonsoft.Json;

public class TestJsonDeseClass
Expand All @@ -101,7 +101,7 @@ public class TestJsonDeseClass

如果把上面的构造方法改成下面这个样子

``` csharp {1}
``` csharp
public TestJsonDeseClass(Guid guid, string message)
{
MessageGuid = guid;
Expand All @@ -113,7 +113,7 @@ public TestJsonDeseClass(Guid guid, string message)

那么,最后一个问题,如果我的类有多个构造方法,我怎样告诉Json.NET应该用哪一个呢?

``` csharp {13}
``` csharp
using Newtonsoft.Json;

public class TestJsonDeseClass
Expand Down
2 changes: 1 addition & 1 deletion content/posts/linux-gpio操作其一.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ categories: ["技术"]

将需要复用的IO添加到`pinctrl_hog`节点,例:

``` c {13-18}
``` c
/* kernel/arch/arm64/boot/dts/freescale/OK8MP-C.dts */
&iomuxc {
pinctrl-names = "default";
Expand Down
6 changes: 3 additions & 3 deletions content/posts/使用 Named Pipe 进行进程间通讯.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ using System.IO.Pipes;

**创建管道**

``` csharp {7,9}
``` csharp
PipeSecurity security = new PipeSecurity(); // 管道权限
// 设置规则,只有用户admin可以对管道进行读写,其它用户无权访问
security.AddAccessRule(new PipeAccessRule("admin", PipeAccessRights.ReadWrite, AccessControlType.Allow));
Expand Down Expand Up @@ -51,7 +51,7 @@ server.WaitForConnection(); // 阻塞方式
server.BeginWaitForConnection(new AsyncCallback(WaitConnectionCallback), server); // 非阻塞方式
```

``` csharp {4,52-54}
``` csharp
private void WaitConnectionCallback(IAsyncResult asyncResult)
{
NamedPipeServerStream server = asyncResult.AsyncState as NamedPipeServerStream;
Expand Down Expand Up @@ -134,7 +134,7 @@ NamedPipeClientStream client = new NamedPipeClientStream(
client.Connect(); // 阻塞方式
```

``` csharp {6}
``` csharp
Task.Run(() =>
{
int bytesToRead;
Expand Down

0 comments on commit 6770c84

Please sign in to comment.