private string GetFolderPath() { Type type = base.GetType(); object[] customAttributes = type.GetCustomAttributes(true); object[] array = customAttributes; for (int i = 0; i < array.Length; i++) { object obj = array[i]; if (obj is LibraryFolderPathAttribute) { LibraryFolderPathAttribute libraryFolderPathAttribute = obj as LibraryFolderPathAttribute; return(libraryFolderPathAttribute.folderPath); } } throw new ArgumentException("The LibraryFolderPathAttribute[] attribute is required for this class."); }
private string GetFolderPath() { Type type = this.GetType(); object[] attributes = type.GetCustomAttributes(true); foreach (object attr in attributes) { if (attr is LibraryFolderPathAttribute) { LibraryFolderPathAttribute f = attr as LibraryFolderPathAttribute; return(f.folderPath); } } // The folder path attribute is required. throw new ArgumentException("The LibraryFolderPathAttribute[] attribute is required for this class."); }