what is the difference between internal and private
10,745
Solution 1
An internal
method can be accessed from any type (or function) in the same .NET assembly.
A private
method can be accessed only from the type where it was declared.
Here is a simple snippet that shows the difference:
type A() =
member internal x.Foo = 1
type B() =
member private x.Foo = 1
let a = A()
let b = B()
a.Foo // Works fine (we're in the same project)
b.Foo // Error FS0491: 'Foo' is not defined
Solution 2
internal is the same as public, except that it is only visible inside the assembly it is delcared in. Private is only visible inside the declaring type.
Author by
Frames Catherine White
(aka oxinabox) she/her/hers. Research Software Engineer, Invenia Labs. PhD, in Natural Language Processing / Machine Learning. Writes a lot of JuliaLang code.
Updated on June 04, 2022Comments
-
Frames Catherine White almost 2 years
In F# what is the difference between an internal method and a private method.
I have a feeling that they are implemented the same, but mean something different.
-
Sandeep G B almost 13 yearsI think it should be no different from C# stackoverflow.com/questions/3813485/…
-