Skip to content

List of nothing like #37

@dzmitry-lahoda

Description

@dzmitry-lahoda

Rx.Net:
https://github.com/dotnet/reactive/blob/525b719f5e341a4c0cc6668028fdd15194de5559/Rx.NET/Source/src/System.Reactive/Unit.cs

System.Threading.Channels:
https://github.com/dotnet/corefx/blob/master/src/System.Threading.Channels/src/System/VoidResult.cs

Other like:

var unitLike1 = new System.ValueTuple();
var unitLike2 = System.Threading.Tasks.Task.CompletedTask;
var unitLike3 = new  System.Threading.Tasks.ValueTask();
object unitLike4 = null;

F# unit

// Unit
using Microsoft.FSharp.Core;
using System;

[Serializable]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public sealed class Unit : IComparable
{
	internal Unit()
	{
		((object)this)..ctor();
	}

	public override int GetHashCode()
	{
		return 0;
	}

	public override bool Equals(object obj)
	{
		if (obj != null)
		{
			if (!LanguagePrimitives.IntrinsicFunctions.TypeTestGeneric<Unit>(obj))
			{
				return false;
			}
			return true;
		}
		return true;
	}

	private virtual int System-IComparable-CompareTo(object _obj)
	{
		return 0;
	}

	int IComparable.CompareTo(object _obj)
	{
		//ILSpy generated this explicit interface implementation from .override directive in System-IComparable-CompareTo
		return this.System-IComparable-CompareTo(_obj);
	}
}

C# void:

// Void
using System;
using System.Runtime.InteropServices;

/// <summary>Specifies a return value type for a method that does not return a value.</summary>
[Serializable]
[StructLayout(LayoutKind.Sequential, Size = 1)]
[ComVisible(true)]
[__DynamicallyInvokable]
public sealed class Void
{
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions