You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Minor Performance Optimization by Reducing Calls to AppDomain.CurrentDomain.FriendlyName (#8567)
* 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 type
0 commit comments