Brubaker Haim
Brubaker Haim

Reputation: 55

Why i'm getting Inconsistent accessibility: field type .... is less accessible than field ? And how to fix it?

Error   1   Inconsistent accessibility: field type 'Youtube_Manager.Ffmpeg' is less accessible than field 'Youtube_Manager.ScreenShot.fmpeg'

In a class top i added:

using System;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using System.ComponentModel;


    namespace Youtube_Manager
    {
        public class ScreenShot
        {

        #region Global Variables
            public static Ffmpeg fmpeg;

Then i'm calling to use fmpeg in another class in a timer click event:

ScreenShot.fmpeg.Close();

And i'm getting in the class ScreenShot on the fmpeg the error:

Error 1 Inconsistent accessibility: field type 'Youtube_Manager.Ffmpeg' is less accessible than field 'Youtube_Manager.ScreenShot.fmpeg'

And this is the top of the class Ffmpeg:

using System;
using System.Windows.Forms;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
using System.IO.Pipes;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.IO;
using DannyGeneral;

namespace Youtube_Manager
{
    class Ffmpeg
    {
        NamedPipeServerStream p;
        String pipename = "mytestpipe";
        System.Diagnostics.Process process;
        string ffmpegFileName = "ffmpeg.exe";
        string workingDirectory;

        public Ffmpeg()
        {

Even if i change the variable fmpeg from static to public i'm getting on it the same error.

Upvotes: 1

Views: 604

Answers (1)

Chris R. Timmons
Chris R. Timmons

Reputation: 2197

Top-level C# classes are internal by default. Internal has a lower visibility than public. Use public class Ffmpeg to make the class public.

Upvotes: 2

Related Questions