@@ -29,8 +29,7 @@ public static void SubmitFromLogEvent(this ExceptionlessClient client, LogEvent
29
29
}
30
30
31
31
internal static string GetSource ( this LogEvent log ) {
32
- LogEventPropertyValue value ;
33
- if ( log . Properties . TryGetValue ( Constants . SourceContextPropertyName , out value ) )
32
+ if ( log . Properties . TryGetValue ( Constants . SourceContextPropertyName , out LogEventPropertyValue value ) )
34
33
return value . FlattenProperties ( ) ? . ToString ( ) ;
35
34
36
35
return null ;
@@ -64,30 +63,26 @@ internal static object FlattenProperties(this LogEventPropertyValue value) {
64
63
if ( value == null )
65
64
return null ;
66
65
67
- var scalar = value as ScalarValue ;
68
- if ( scalar != null )
66
+ if ( value is ScalarValue scalar )
69
67
return scalar . Value ;
70
68
71
- var sequence = value as SequenceValue ;
72
- if ( sequence != null ) {
69
+ if ( value is SequenceValue sequence ) {
73
70
var flattenedProperties = new List < object > ( sequence . Elements . Count ) ;
74
71
foreach ( var element in sequence . Elements )
75
72
flattenedProperties . Add ( element . FlattenProperties ( ) ) ;
76
73
77
74
return flattenedProperties ;
78
75
}
79
76
80
- var structure = value as StructureValue ;
81
- if ( structure != null ) {
77
+ if ( value is StructureValue structure ) {
82
78
var flattenedProperties = new Dictionary < string , object > ( structure . Properties . Count ) ;
83
79
foreach ( var property in structure . Properties )
84
80
flattenedProperties . Add ( property . Name , property . Value . FlattenProperties ( ) ) ;
85
81
86
82
return flattenedProperties ;
87
83
}
88
84
89
- var dictionary = value as DictionaryValue ;
90
- if ( dictionary != null ) {
85
+ if ( value is DictionaryValue dictionary ) {
91
86
var flattenedProperties = new Dictionary < object , object > ( dictionary . Elements . Count ) ;
92
87
foreach ( var element in dictionary . Elements )
93
88
flattenedProperties . Add ( element . Key . Value , element . Value . FlattenProperties ( ) ) ;
0 commit comments