forked from xamarin/XamarinCommunityToolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObjectToNameConverter.shared.cs
More file actions
40 lines (37 loc) · 1.68 KB
/
Copy pathObjectToNameConverter.shared.cs
File metadata and controls
40 lines (37 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using System.Globalization;
using Xamarin.CommunityToolkit.Extensions.Internals;
using Xamarin.Forms;
namespace Xamarin.CommunityToolkit.Converters
{
/// <summary>
/// A converter that returns the name of the object.
/// </summary>
public class ObjectToNameConverter : ValueConverterExtension, IValueConverter
{
/// <summary>
/// Returns the name of the name of the object.
/// </summary>
/// <param name="value">The string to split.</param>
/// <param name="targetType">The type of the binding target property. This is not implemented.</param>
/// <param name="parameter">The string or strings that delimits the substrings in this string. This overrides the value in <see cref="Separator"/> and <see cref="Separators"/>.</param>
/// <param name="culture">The culture to use in the converter. This is not implemented.</param>
/// <returns>An array whose elements contain the substrings in this string that are delimited by <see cref="Separator"/> or, if set, <see cref="Separators"/> or, if set, <paramref name="parameter"/>.</returns>
public object? Convert(object value, Type? targetType, object? parameter, CultureInfo? culture)
{
if (value is Type type)
return type.Name;
return string.Empty;
}
/// <summary>
/// This method is not implemented and will throw a <see cref="NotImplementedException"/>.
/// </summary>
/// <param name="value">N/A</param>
/// <param name="targetType">N/A</param>
/// <param name="parameter">N/A</param>
/// <param name="culture">N/A</param>
/// <returns>N/A</returns>
public object? ConvertBack(object? value, Type? targetType, object? parameter, CultureInfo? culture)
=> throw new NotImplementedException();
}
}