What does this error mean? Inconsistent availability: the field type "DannyGeneral.OptionsFile" is less accessible than the field "AnimationEditor.Form1"

Inconsistent accessibility: field type 'DannyGeneral.OptionsFile' is less accessible than field 'AnimationEditor.Form1.setting_file' 

In Form1, I did:

 public OptionsFile setting_file; 

The error is in setting_file.

This is the beginning of the Options_File code:

 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Net; using System.IO; using System.Configuration; namespace DannyGeneral { class OptionsFile { string path_exe; string temp_settings_file; string temp_settings_dir; string Options_File; StreamWriter sw; StreamReader sr; public OptionsFile(string settings) { if (!File.Exists(settings)) { if (!Directory.Exists(Path.GetDirectoryName(settings))) { Directory.CreateDirectory(Path.GetDirectoryName(settings)); } File.Create(settings).Close(); } path_exe = Path.GetDirectoryName(Application.LocalUserAppDataPath); Options_File = settings; } 

And in the form of 1 top:

 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; using DannyGeneral; using unfreez_wrapper; namespace AnimationEditor { public partial class Form1 : Form { private static string settings_dir; private static string settings_file; public OptionsFile setting_file; 
+4
source share
3 answers

You need the OptionsFile type OptionsFile be public if you want to use it as a public property.

Limitations on the use of accessibility levels (link to C #)

+9
source

Mark the OptionsFile class as public or mark the setting_File field as non-public ( internal or private ).

+2
source

I had the same problem, but I am getting it now for people who do not understand this.

  namespace DannyGeneral { public class OptionsFile { string path_exe; string temp_settings_file; string temp_settings_dir; string Options_File; StreamWriter sw; StreamReader sr; 
0
source

All Articles