How to operate multiple contional features in C-sharp

to achieve the effect of logical and operations on symbols, you can define sequence conditional methods. For example, the second method can be executed only if both An and B are defined:
[Conditional ("A")]
static void DoIfA ()
{

DoIfAandB();

}

[Conditional ("B")]
static void DoIfAandB ()
{

// Code to execute when both A and B are defined...

}
after testing, only the definition of Bmai DoIfAandB can be executed. The following code outputs B.

-sharpdefine B
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;


namespace 
{
    class Program
    {
        [Conditional("A")]
        static void DoIfA()
        {
            DoIfAandB();
        }

        [Conditional("B")]
        static void DoIfAandB()
        {
            Console.WriteLine( "B" );
            // Code to execute when both A and B are defined...
        }
        static void Main(string[] args)
        {
            DoIfAandB();
        }
    }
}
Sep.23,2021
  • Questions about the singleton pattern in unity?

    based on unity and C-sharp, there is a code from conception to implementation as follows. I don t understand why this code is singleton mode. public class BoidSpawner : MonoBehaviour{ static public BoidSpawner S; ..... public GameObjec...

    Jul.22,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eafe32-228e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eafe32-228e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?