Method.Results 2.5.0

dotnet add package Method.Results --version 2.5.0
NuGet\Install-Package Method.Results -Version 2.5.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Method.Results" Version="2.5.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Method.Results --version 2.5.0
#r "nuget: Method.Results, 2.5.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Method.Results as a Cake Addin
#addin nuget:?package=Method.Results&version=2.5.0

// Install Method.Results as a Cake Tool
#tool nuget:?package=Method.Results&version=2.5.0

Requaried

using Results.Abstract;
using Results.State;

How to use

IResult default

public IResult Add(string text)
{
  if(text == null)
  {
    return new ErrorResult(); // ErrorResult => false 
  }
  //add operation
  return new SuccessResult(); // SuccessResult => true
}

IResult Overloads (message)

public IResult Add(string text)
{
  if(text == null)
  {
    return new ErrorResult(message:"Not Null"); // ErrorResult => false and message
  }
  //add operation
  return new SuccessResult(message:" Success Add "); // SuccessResult => true and message
}

IResult Overloads (message and tags)

public IResult Add(string text)
{
  if(text == null)
  {
    return new ErrorResult(message:"Not Null","Errortag","ErrorTag1","ErrorTag2"); // ErrorResult => false , message and tags
  }
  //add operation
  return new SuccessResult(message:" Success Add ","Successtag","SuccessTag1","SuccessTag2"); // SuccessResult => true , message and tags
}

ISingleDataResult<SingleData>

public ISingleDataResult<Product> GetByProductId(int productId)
{
    // SuccessSingleDataResult<Product> => Product and true 
    return new SuccessSingleDataResult<Product>(_productDal.GetProduct(product => product.Id == productId)); 
}

ISingleDataResult<SingleData> OverLoads

public ISingleDataResult<Product> GetByProductId(int productId)
{
    // SuccessSingleDataResult<Product> => Product , true and message
    return new SuccessSingleDataResult<Product>(_productDal.GetProduct(product => product.Id == productId),message:" Data Listed ");  
}

IListDataResult<ListData>

public IListDataResult<Product> GetByCategory(int categoryId)
{
// SuccessListDataResult<Product> => List<Product> , true and count
  return new SuccessListDataResult<Product>(_productDal.GetAll(product => product.categoryId == categoryId)); 
}

IListDataResult<ListData> OverLoads

public IListDataResult<Product> GetByCategory(int categoryId)
{
  // SuccessListDataResult<Product> => List<Product> , true , message and count
  return new SuccessListDataResult<Product>(_productDal.GetAll(product => product.categoryId == categoryId),message:"data listed"); 
}

IDataResult<Data>

public IDataResult<Product> GetByProductId(int productId)
{
  // SuccessDataResult<Product> => Product and true
  return new SuccessDataResult<Product>(_productDal.Get(product => product.productId == productId)); 
}

IDataResult<Data> OverLoads

public IDataResult<Product> GetByProductId(int productId)
{
  // SuccessDataResult<Product> => Product , true , message and tags
  return new SuccessDataResult<Product>(_productDal.Get(product => product.productId == productId),message:"data listed","tag1","tag2"); 
}

IDataResult<Data> List

public IDataResult<List<Product>> GetAll()
{
  // SuccessDataResult<List<Product>> => Product List and true
  return new SuccessDataResult<List<Product>>(_productDal.GetAll()); 
}

IDataResult<Data> List OverLoads

public IDataResult<List<Product>> GetAll()
{
  // SuccessDataResult<List<Product>> => Product List, true , message and tags
  return new SuccessDataResult<List<Product>>(_productDal.GetAll(),message:"data listed","tag1","tag2"); 
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.5.0 1,476 3/12/2022
2.2.0 767 11/16/2021
2.1.1 807 9/3/2021
2.1.0 764 6/22/2021
2.0.6 818 5/25/2021
2.0.5 803 5/21/2021
2.0.3 815 5/20/2021
2.0.2 820 5/20/2021
2.0.1 804 5/18/2021
2.0.0 803 5/18/2021
1.0.1 790 5/17/2021

New Tools