Skip to content

Commit 936e512

Browse files
committed
new extensions
1 parent 13fb493 commit 936e512

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/DistributedCache/Extensions/StringExtensions.cs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,28 @@ namespace DistributedCache.Extensions;
44

55
public static class StringExtensions
66
{
7-
public static string PrefixWith(this string value, string prefix)
8-
{
9-
return $"{prefix}{value}";
10-
}
117

12-
public static string PrefixWith(this string value, Assembly assembly)
8+
public static string PrefixWithAssemblyName(this string value)
139
{
14-
return $"{assembly.GetName().Name}:{value}";
10+
var assembly = Assembly.GetCallingAssembly();
11+
return value.PrefixWith(assembly.GetName()
12+
.Name!);
1513
}
1614

17-
public static List<string> PrefixWith(this IEnumerable<string> values, string prefix)
15+
public static List<string> PrefixWithAssemblyName(this IEnumerable<string> values)
1816
{
19-
return values.Select(x => x.PrefixWith(prefix))
17+
var assembly = Assembly.GetCallingAssembly().GetName().Name;
18+
return values.Select(x => x.PrefixWith(assembly!))
2019
.ToList();
2120
}
2221

23-
public static List<string> PrefixWith(this IEnumerable<string> values, Assembly assembly)
22+
public static string PrefixWith(this string value, string prefix)
23+
{
24+
return $"{prefix}{value}";
25+
}
26+
public static List<string> PrefixWith(this IEnumerable<string> values, string prefix)
2427
{
25-
return values.Select(x => x.PrefixWith(assembly))
28+
return values.Select(x => x.PrefixWith(prefix))
2629
.ToList();
2730
}
2831
}

0 commit comments

Comments
 (0)