Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion YamlDotNet/Serialization/IPropertyDescriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public interface IPropertyDescriptor
int Order { get; set; }
ScalarStyle ScalarStyle { get; set; }

T GetCustomAttribute<T>() where T : Attribute;
T? GetCustomAttribute<T>() where T : Attribute;

IObjectDescriptor Read(object target);
void Write(object target, object? value);
Expand Down
2 changes: 1 addition & 1 deletion YamlDotNet/Serialization/PropertyDescriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void Write(object target, object? value)
baseDescriptor.Write(target, value);
}

public T GetCustomAttribute<T>() where T : Attribute
public T? GetCustomAttribute<T>() where T : Attribute
{
return baseDescriptor.GetCustomAttribute<T>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ public void Write(object target, object? value)
fieldInfo.SetValue(target, value);
}

public T GetCustomAttribute<T>() where T : Attribute
public T? GetCustomAttribute<T>() where T : Attribute
{
var attributes = fieldInfo.GetCustomAttributes(typeof(T), true);
return (T)attributes.FirstOrDefault();
return (T?)attributes.FirstOrDefault();
}

public IObjectDescriptor Read(object target)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ public void Write(object target, object? value)
propertyInfo.SetValue(target, value, null);
}

public T GetCustomAttribute<T>() where T : Attribute
public T? GetCustomAttribute<T>() where T : Attribute
{
var attributes = propertyInfo.GetAllCustomAttributes<T>();
return (T)attributes.FirstOrDefault();
return (T?)attributes.FirstOrDefault();
}

public IObjectDescriptor Read(object target)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ public void Write(object target, object? value)
propertyInfo.SetValue(target, value, null);
}

public T GetCustomAttribute<T>() where T : Attribute
public T? GetCustomAttribute<T>() where T : Attribute
{
var attributes = propertyInfo.GetAllCustomAttributes<T>();
return (T)attributes.FirstOrDefault();
return (T?)attributes.FirstOrDefault();
}

public IObjectDescriptor Read(object target)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void Write(object target, object? value)
baseDescriptor.Write(target, value);
}

public T GetCustomAttribute<T>() where T : Attribute
public T? GetCustomAttribute<T>() where T : Attribute
{
var attr = overrides.GetAttribute<T>(classType, Name);
return attr ?? baseDescriptor.GetCustomAttribute<T>();
Expand Down