Skip to content

Commit 75842f8

Browse files
authored
Merge pull request #5630 from IvenBach/Opportunistic_edits
Opportunistic minor teaks.
2 parents b8da683 + 7088ffc commit 75842f8

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

Rubberduck.Parsing/ComHelper.cs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,22 @@ public class ComHelper
1616
/// <returns>A string containing the type name.</returns>
1717
public static string GetTypeName(object comObj)
1818
{
19-
2019
if (comObj == null)
21-
return String.Empty;
20+
{
21+
return string.Empty;
22+
}
2223

2324
if (!Marshal.IsComObject(comObj))
25+
{
2426
//The specified object is not a COM object
25-
return String.Empty;
27+
return string.Empty;
28+
}
2629

27-
IDispatch dispatch = comObj as IDispatch;
28-
if (dispatch == null)
30+
if (!(comObj is IDispatch dispatch))
31+
{
2932
//The specified COM object doesn't support getting type information
30-
return String.Empty;
33+
return string.Empty;
34+
}
3135

3236
ComTypes.ITypeInfo typeInfo = null;
3337
try
@@ -43,15 +47,14 @@ public static string GetTypeName(object comObj)
4347
return string.Empty;
4448
}
4549

46-
string typeName = "";
47-
string documentation, helpFile;
50+
string typeName = string.Empty;
4851
int helpContext = -1;
4952

5053
try
5154
{
5255
//retrieves the documentation string for the specified type description
53-
typeInfo.GetDocumentation(-1, out typeName, out documentation,
54-
out helpContext, out helpFile);
56+
typeInfo.GetDocumentation(-1, out typeName, out string documentation,
57+
out helpContext, out string helpFile);
5558
}
5659
catch (Exception)
5760
{

0 commit comments

Comments
 (0)