Commit f19253d
authored
Minor Performance Optimization by Reducing Calls to
* Minor Optimize Performance by Reducing Calls to `AppDomain.CurrentDomain.FriendlyName`
I have optimized the performance by reducing the number of times `AppDomain.CurrentDomain.FriendlyName` property is accessed. Accessing the FriendlyName property is not cheap and results in some additional performance overhead. By assigning it to a local variable first, I have managed to reduce multiple property accesses, thereby slightly improving performance without altering the existing logic.
```
public sealed partial class AppDomain : MarshalByRefObject
{
public string FriendlyName
{
get
{
Assembly? assembly = Assembly.GetEntryAssembly();
return assembly != null ? assembly.GetName().Name! : "DefaultDomain";
}
}
}
```
* Using the special string typeAppDomain.CurrentDomain.FriendlyName (#8567)1 parent 8f308f4 commit f19253d
File tree
1 file changed
+4
-3
lines changed1 file changed
+4
-3
lines changedLines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
99 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
100 | 101 | | |
101 | | - | |
| 102 | + | |
102 | 103 | | |
103 | 104 | | |
104 | 105 | | |
| |||
0 commit comments