C# Lokal namespace dışında tanımlanan bir sınıfa ismiyle erişemiyor musunuz? Korkmayın “global::” bu günler için!

H

HZ.CİN

Cin Terbiyecisi
Ultra Member
Joined
Dec 22, 2019
Messages
387
Reaction score
73
Location
Cehennem
C# Lokal namespace dışında tanımlanan bir sınıfa ismiyle erişemiyor musunuz? Korkmayın “global::” bu günler için!

C#:
using System;
 
class Test
{
    public void test()
    {
        Console.WriteLine("Test 1");
    }
}
 
namespace TestNamespace
{
    class Test
    {
        public void test()
        {
            Console.WriteLine("Test 2");
        }
    }
 
    class Program
    {
        protected static global::Test testObj1 = new global::Test();
 
        static void Main(string[] args)
        {
            testObj1.test(); //Test 1 yazar
            Test testObj2 = new Test();
            testObj2.test(); //Test 2 yazar
        }
    }
}
 
SPAM IS FORBIDDEN!
  • SPAMMERS ARE BANNED FROM THE FORUM AND CANNOT USE ANY OF THE CHEATS
  • For example: thanks, thx, very good, asdqwe, working, ty and so on!
  • For example: Writing the same message over and over. thanks, thx and so on!
  • Copying and copying someone else's message is prohibited.
  • It is forbidden to send messages to increase the number of comments on threads that you have no knowledge of.
  • Write your own opinion when commenting!
  • If you see spam message, please let us know with the REPORT button!

Tema düzenleyici

Top Bottom