File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -16,18 +16,22 @@ public class ComHelper
16
16
/// <returns>A string containing the type name.</returns>
17
17
public static string GetTypeName ( object comObj )
18
18
{
19
-
20
19
if ( comObj == null )
21
- return String . Empty ;
20
+ {
21
+ return string . Empty ;
22
+ }
22
23
23
24
if ( ! Marshal . IsComObject ( comObj ) )
25
+ {
24
26
//The specified object is not a COM object
25
- return String . Empty ;
27
+ return string . Empty ;
28
+ }
26
29
27
- IDispatch dispatch = comObj as IDispatch ;
28
- if ( dispatch == null )
30
+ if ( ! ( comObj is IDispatch dispatch ) )
31
+ {
29
32
//The specified COM object doesn't support getting type information
30
- return String . Empty ;
33
+ return string . Empty ;
34
+ }
31
35
32
36
ComTypes . ITypeInfo typeInfo = null ;
33
37
try
@@ -43,15 +47,14 @@ public static string GetTypeName(object comObj)
43
47
return string . Empty ;
44
48
}
45
49
46
- string typeName = "" ;
47
- string documentation , helpFile ;
50
+ string typeName = string . Empty ;
48
51
int helpContext = - 1 ;
49
52
50
53
try
51
54
{
52
55
//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 ) ;
55
58
}
56
59
catch ( Exception )
57
60
{
You can’t perform that action at this time.
0 commit comments