What's new

C# Tama po ba tong code ko?

Status
Not open for further replies.

Chunchunmaru

Eternal Poster
Joined
Aug 31, 2021
Posts
766
Reaction
288
Points
393
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
You do not have permission to view the full content of this post. Log in or register now.
 

Attachments

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.

Similar threads

Back
Top