mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 10:34:30 +08:00
docs(core): 更新文档中的代码格式和类型标记
- 修复 IfType<T, TResult> 扩展方法的类型格式显示 - 更正 Contains<T>() 方法的类型标记格式 - 统一代码块标记为正确的 ```csharp 格式 - 修正 IQuery<TResult> 接口的类型标记显示
This commit is contained in:
parent
50a71403bb
commit
033e2b076a
@ -252,7 +252,7 @@ obj.IfType<IRule>(
|
||||
);
|
||||
```
|
||||
|
||||
#### IfType<T, TResult> 扩展方法
|
||||
#### IfType`<T, TResult>` 扩展方法
|
||||
|
||||
```csharp
|
||||
public static TResult? IfType<T, TResult>(
|
||||
|
||||
@ -381,7 +381,7 @@ var allServices = container.GetAll<IDataService>(); // 返回两个实例的列
|
||||
|
||||
## 其他实用方法
|
||||
|
||||
### `Contains<T>()`
|
||||
### Contains`<T>`()
|
||||
|
||||
检查容器中是否包含指定类型的实例。
|
||||
|
||||
@ -439,7 +439,7 @@ public bool ContainsInstance(object instance)
|
||||
|
||||
**使用示例:**
|
||||
|
||||
``csharp
|
||||
```csharp
|
||||
var container = new IocContainer();
|
||||
|
||||
var service = new MyService();
|
||||
@ -609,7 +609,7 @@ public class GameArchitecture : Architecture
|
||||
|
||||
### 2. 使用接口类型注册
|
||||
|
||||
``csharp
|
||||
```csharp
|
||||
// ❌ 不推荐:直接使用实现类
|
||||
RegisterSystem(new ConcreteSystem());
|
||||
var system = GetSystem<ConcreteSystem>();
|
||||
@ -621,7 +621,7 @@ var system = GetSystem<IGameSystem>();
|
||||
|
||||
### 3. 避免运行时频繁注册
|
||||
|
||||
``csharp
|
||||
``` csharp
|
||||
// ❌ 不好:游戏运行时频繁注册
|
||||
void Update()
|
||||
{
|
||||
|
||||
@ -7,7 +7,7 @@ Query 包实现了 CQRS(命令查询职责分离)模式中的查询部分。
|
||||
|
||||
## 核心接口
|
||||
|
||||
### IQuery<TResult>
|
||||
### IQuery`<TResult>`
|
||||
|
||||
查询接口,定义了查询的基本契约。
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user