Access to members with case-sensitive names in different languages ​​in .NET.

I came across an interesting scenario. I have a class in C #:

public class Test
{
  public int A;
  public int a;
}

Since C # is case sensitive, it will handle the two variables Aboth Aas different. I want to inherit the above class in my VB code, which is not case sensitive. How will VB code access two different variables Aand A?

Any help is appreciated.

+3
source share
4 answers

(CLS), , , , . CLS.

, API , :

obj.GetType().GetField("a").GetValue(obj)
obj.GetType().GetField("A").GetValue(obj)
+6

, CLS-, ,

, CLS, .NET,

[assembly: System.CLSCompliant(true)]

AssemblyInfo.cs, - , :)
EDIT: AssemblyInfo.vb, VB.NET, Lucas

+5

, -

,

, , , ,

, : -)

+1

, , .

It’s very difficult for me personally to have two public members having the same name, but with different capitalization.

0
source

Source: https://habr.com/ru/post/1706395/


All Articles