#️⃣ C# Tama po ba tong code ko?

Status
Not open for further replies.

Chunchunmaru

Eternal Poster
eto po ung code:
C#:
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;

namespace DelegateProgram
{
    
  
    }
    
    public delegate string name(string firstName, string lastName);
  
    
    public class  NameDelegate
    {
        
    public static string FullName(string firstName, string lastName)
    {
        return firstName + lastName;
    }
    
    public static string Message(string message1, string message2)
    {
        return message1 + message2;
    }
    
    
        
        public static void Main()
        {
            name delAdd1 = NameDelegate.FullName;
            name delAdd2 = NameDelegate.Message;
            
            MessageBox.Show(delAdd1("Mai", " Sakurajima").ToString(), delAdd2("Megumin", " the Founder of Chunchunmaru").ToString());
        }
    }
Eto yung tanong

IMG_20211017_095722.webp

 
tama naman ata lods meron ka dn naman ng event message,,
SS mo na dn cguro yung output para mas madali intindihin
 
C#:
using System;

namespace testr
{
    public delegate string name(string first, string last);
    class Program
    {
        public static string fullname;
        public static void Main(string[] args)
        {
            //name setFullName = new name(GetFullName);
            //setFullName("First", "Last");
            //Console.WriteLine($"fullname is: {getFullName()}");

            name setFullname = Program.GetFullName;
            Console.WriteLine($"fullname is: {setFullname("First","Last")}");
        }

        public static string GetFullName(string first, string last)
        {
            //fullname = first + " " + last;
            //return fullname;

            return first + " " + last;
        }

        public static string getFullName()
        {
            return fullname;
        }
    }
}



ganito ko nagawa.. both commented and yours are working.

it should be fine..
 
Status
Not open for further replies.

About this Thread

  • 2
    Replies
  • 442
    Views
  • 3
    Participants
Last reply from:
vespine

Trending Topics

Online now

Members online
958
Guests online
1,116
Total visitors
2,074

Forum statistics

Threads
2,274,257
Posts
28,954,673
Members
1,234,170
Latest member
Ichigooooooo
Back
Top