File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed
src/toolkit/Community.VisualStudio.Toolkit.Shared/Commands Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . ComponentModel . Design ;
3
- using System . Linq ;
3
+ using System . Reflection ;
4
4
using System . Threading . Tasks ;
5
5
using Microsoft ;
6
6
using Microsoft . VisualStudio . Shell ;
@@ -34,9 +34,7 @@ public static async Task<T> InitializeAsync(AsyncPackage package)
34
34
{
35
35
BaseCommand < T > instance = ( BaseCommand < T > ) ( object ) new T ( ) ;
36
36
37
- CommandAttribute ? attr = ( CommandAttribute ) instance . GetType ( ) . GetCustomAttributes ( typeof ( CommandAttribute ) , true ) . FirstOrDefault ( ) ;
38
-
39
- if ( attr is null )
37
+ if ( instance . GetType ( ) . GetCustomAttribute ( typeof ( CommandAttribute ) ) is not CommandAttribute attr )
40
38
{
41
39
throw new InvalidOperationException ( $ "No [Command(GUID, ID)] attribute was added to { typeof ( T ) . Name } ") ;
42
40
}
You can’t perform that action at this time.
0 commit comments