@@ -23,65 +23,65 @@ public sealed class CreateNewModel
23
23
public string Title
24
24
{
25
25
get => title ;
26
- set => SetProperty ( ref title , value ) ;
26
+ set => SetProperty ( out title , value ) ;
27
27
}
28
28
29
29
[ Required ]
30
30
public string ShortDescription
31
31
{
32
32
get => shortDescription ;
33
- set => SetProperty ( ref shortDescription , value ) ;
33
+ set => SetProperty ( out shortDescription , value ) ;
34
34
}
35
35
36
36
[ Required ]
37
37
public string Content
38
38
{
39
39
get => content ;
40
- set => SetProperty ( ref content , value ) ;
40
+ set => SetProperty ( out content , value ) ;
41
41
}
42
42
43
43
[ Required ]
44
44
[ MaxLength ( 1024 ) ]
45
45
public string PreviewImageUrl
46
46
{
47
47
get => previewImageUrl ;
48
- set => SetProperty ( ref previewImageUrl , value ) ;
48
+ set => SetProperty ( out previewImageUrl , value ) ;
49
49
}
50
50
51
51
[ Required ]
52
52
[ PublishedWithScheduledDateValidation ]
53
53
public bool IsPublished
54
54
{
55
55
get => isPublished ;
56
- set => SetProperty ( ref isPublished , value ) ;
56
+ set => SetProperty ( out isPublished , value ) ;
57
57
}
58
58
59
59
[ Required ]
60
60
public bool ShouldUpdateDate
61
61
{
62
62
get => shouldUpdateDate ;
63
- set => SetProperty ( ref shouldUpdateDate , value ) ;
63
+ set => SetProperty ( out shouldUpdateDate , value ) ;
64
64
}
65
65
66
66
[ FutureDateValidation ]
67
67
public DateTime ? ScheduledPublishDate
68
68
{
69
69
get => scheduledPublishDate ;
70
- set => SetProperty ( ref scheduledPublishDate , value ) ;
70
+ set => SetProperty ( out scheduledPublishDate , value ) ;
71
71
}
72
72
73
73
public string Tags
74
74
{
75
75
get => tags ;
76
- set => SetProperty ( ref tags , value ) ;
76
+ set => SetProperty ( out tags , value ) ;
77
77
}
78
78
79
79
[ MaxLength ( 256 ) ]
80
80
[ FallbackUrlValidation ]
81
81
public string PreviewImageUrlFallback
82
82
{
83
83
get => previewImageUrlFallback ;
84
- set => SetProperty ( ref previewImageUrlFallback , value ) ;
84
+ set => SetProperty ( out previewImageUrlFallback , value ) ;
85
85
}
86
86
87
87
public bool IsDirty { get ; private set ; }
@@ -108,7 +108,9 @@ public static CreateNewModel FromBlogPost(BlogPost blogPost)
108
108
109
109
public BlogPost ToBlogPost ( )
110
110
{
111
- var tagList = string . IsNullOrWhiteSpace ( Tags ) ? ArraySegment < string > . Empty : Tags . Split ( "," ) ;
111
+ var tagList = string . IsNullOrWhiteSpace ( Tags )
112
+ ? Array . Empty < string > ( )
113
+ : Tags . Split ( "," , StringSplitOptions . RemoveEmptyEntries ) ;
112
114
DateTime ? updatedDate = ShouldUpdateDate || originalUpdatedDate == default
113
115
? null
114
116
: originalUpdatedDate ;
@@ -127,7 +129,7 @@ public BlogPost ToBlogPost()
127
129
return blogPost ;
128
130
}
129
131
130
- private void SetProperty < T > ( ref T backingField , T value )
132
+ private void SetProperty < T > ( out T backingField , T value )
131
133
{
132
134
backingField = value ;
133
135
IsDirty = true ;
0 commit comments