Jump to content

Adz Baywes

Members
  • Content Count

    8
  • Joined

  • Last visited

Posts posted by Adz Baywes


  1. Hi Vincent, thanks for taking the time answering my inquiry. I was also looking at your CancellationToken yesterday as it may be needed on my project, the C# code does use it. The example and explanation you have provided is sufficient for now. I will have to do some more research and read up on the link you have provided. Will be posting if anything comes up. Thanks again!


  2. I am currently converting some C# code to Delphi and came across some methods that I am not sure on how to properly translate. The C# goes like this:

    public class Test
    {
    	public string TestMe { get; set; }
    	public string Category(string cat)
    	{
    		...
    	}
    }
    
    ...
    
    public class DoTest
    {
    	public async Task<Test> Meth(string message)
    	{
    		return await Category(message);
    	}
    }

    The async Task<T> Meth() function is where I'm lost

    type
      TTest = class
      private
        FTestMe: string;
    	FCategory: string;
      public
        function TestMe: string read FTestMe write FTestMe
    	function Category: string read FCategory write FCategory
      end;
      
    ...
    
    type
      TDoTest = class
      public
        function Meth(AMessage: string): Test
      end;  
      
    implementation
    
    function TDoTest.Meth(AMessage: string): Test
    var
      MyTask: ITask;
    begin
      MyTask := TTask.Create(
        procedure
    	begin
    	  ...
    	end
      );
      MyTask.Start;
    end;

    Can this be done with PPL and is my declaration/implementation of the function even correct?

×