Skip to content

Commit fbcb53b

Browse files
authored
Merge pull request #3755 from arphox/docs/fix_SA1102_code_examples
Update documentation for SA1102 to contain compilable code examples
2 parents e22309f + 515ac83 commit fbcb53b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

documentation/SA1102.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,21 @@ A C# query clause does not begin on the same line as the previous clause, or on
2727

2828
A violation of this rule occurs when a clause within a query expression does not begin on the same line as the previous clause, or on the line after the query clause. For example:
2929
```c#
30-
object x = select a in b
30+
object x = from num in numbers
3131

32-
from c;
32+
select num;
3333
```
3434

3535
The query clause can correctly be written as:
3636
```c#
37-
object x = select a in b from c;
37+
object x = from num in numbers select num;
3838
```
3939
or:
4040
```c#
4141
object x =
42-
select a
43-
in b
44-
from c;
42+
from num
43+
in numbers
44+
select num;
4545
```
4646

4747
## How to fix violations
@@ -52,8 +52,8 @@ To fix a violation of this rule, ensure that each clause in the query expression
5252

5353
```c#
5454
#pragma warning disable SA1102 // Query clause should follow previous clause
55-
object x = select a in b
55+
object x = from num in numbers
5656

57-
from c;
57+
select num;
5858
#pragma warning restore SA1102 // Query clause should follow previous clause
5959
```

0 commit comments

Comments
 (0)