From d6a03aa8f2b952776a7eeb1bce39e8316cb9dca8 Mon Sep 17 00:00:00 2001 From: yasirkula Date: Sun, 1 Jun 2025 17:55:12 +0300 Subject: [PATCH] readonly struct optimization --- Plugins/AssetUsageDetector/Editor/VariableGetter.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Plugins/AssetUsageDetector/Editor/VariableGetter.cs b/Plugins/AssetUsageDetector/Editor/VariableGetter.cs index 87c8fa9..5b44e10 100644 --- a/Plugins/AssetUsageDetector/Editor/VariableGetter.cs +++ b/Plugins/AssetUsageDetector/Editor/VariableGetter.cs @@ -9,14 +9,14 @@ namespace AssetUsageDetectorNamespace public delegate object VariableGetVal( object obj ); // Custom struct to hold a variable, its important properties and its getter function - public struct VariableGetterHolder + public readonly struct VariableGetterHolder { public readonly MemberInfo variable; public readonly bool isSerializable; private readonly VariableGetVal getter; - public string Name { get { return variable.Name; } } - public bool IsProperty { get { return variable is PropertyInfo; } } + public readonly string Name { get { return variable.Name; } } + public readonly bool IsProperty { get { return variable is PropertyInfo; } } public VariableGetterHolder( FieldInfo fieldInfo, VariableGetVal getter, bool isSerializable ) { @@ -32,7 +32,7 @@ namespace AssetUsageDetectorNamespace this.getter = getter; } - public object Get( object obj ) + public readonly object Get( object obj ) { try {