Skip to content

Commit

Permalink
[TypeSdkGenerator] Fixed issue with ObservableCollection namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
wannkunstbeikor committed Oct 28, 2023
1 parent c4d02c0 commit 6f20eb9
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public partial struct {structContext.Name}
{{
public bool Equals({structContext.Name} b)
{{
return {string.Join(" && ", structContext.Fields.Select(static field => field.Type.Contains("global::System.Collections.Generic.ObservableCollection<") ? $"{field.Name}.SequenceEqual(b.{field.Name})" : $"{field.Name} == b.{field.Name}"))};
return {string.Join(" && ", structContext.Fields.Select(static field => field.Type.Contains("global::System.Collections.ObjectModel.ObservableCollection<") ? $"{field.Name}.SequenceEqual(b.{field.Name})" : $"{field.Name} == b.{field.Name}"))};
}}
public override bool Equals(object? obj)
Expand Down Expand Up @@ -354,7 +354,7 @@ protected override CString GetId()
{{
return __id;
}}
if (!string.IsNullOrEmpty({field.Name}))
{{
return {field.Name}.Sanitize();
Expand All @@ -378,13 +378,13 @@ private static void CreateProperties(SourceProductionContext context, TypeContex
public partial {(typeContext.IsValueType ? "struct" : "class")} {typeContext.Name}
{{";
bool needsConstructor =
typeContext.Fields.Any(static f => f.Type.Contains("global::System.Collections.Generic.ObservableCollection<"));
typeContext.Fields.Any(static f => f.Type.Contains("global::System.Collections.ObjectModel.ObservableCollection<"));
string constructor = string.Empty;
foreach (FieldContext field in typeContext.Fields)
{
if (needsConstructor)
{
if (field.Type.Contains("global::System.Collections.Generic.ObservableCollection<"))
if (field.Type.Contains("global::System.Collections.ObjectModel.ObservableCollection<"))
{
constructor += $"\n {field.Name} = new();";
}
Expand Down

0 comments on commit 6f20eb9

Please sign in to comment.