Skip to content

Commit 4da74de

Browse files
committed
Update C# example
1 parent 0a4b828 commit 4da74de

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

docs/language/learn-ql/csharp/basic-query-csharp.rst

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,17 @@ Browsing the results of our basic query shows that it could be improved. Among t
106106

107107
.. code-block:: csharp
108108
109-
if (...) {
110-
...
111-
} else if (string.Compare(option, "-verbose")==0) {
112-
// nothing to do - handled earlier
113-
} else {
114-
error("unrecognized option");
109+
if (...)
110+
{
111+
...
112+
}
113+
else if (option == "-verbose")
114+
{
115+
// nothing to do - handled earlier
116+
}
117+
else
118+
{
119+
error("unrecognized option");
115120
}
116121
117122
In this case, identifying the ``if`` statement with the empty ``then`` branch as redundant is a false positive. One solution to this is to modify the query to ignore empty ``then`` branches if the ``if`` statement has an ``else`` branch.

0 commit comments

Comments
 (0)