Информация об изменениях

Сообщение Различить сигнатуры через contraints от 17.01.2025 13:57

Изменено 17.01.2025 13:58 Barbar1an

Различить сигнатуры через contraints
Имеем

public static E Read<E>(this BinaryReader reader) where E : struct, System.Enum

public static T Read<T>(this BinaryReader r) where T : IBinarySerializable, new()


В итоге "error CS0111: Type 'Extentions' already defines a member called 'Read' with the same parameter types"

как разрулить чисто contraints?

ЖПТ предложил много чего в том числе и не работающий
public static T Read<T>(this BinaryReader reader) where T : class, IBinarySerializable, new()
Различить сигнатуры через contraints
Имеем

public static E Read<E>(this BinaryReader reader) where E : struct, System.Enum

public static T Read<T>(this BinaryReader r) where T : IBinarySerializable, new()


В итоге "error CS0111: Type 'Extentions' already defines a member called 'Read' with the same parameter types"

как разрулить чисто через contraints?

ЖПТ предложил много чего в том числе и не работающий
public static T Read<T>(this BinaryReader reader) where T : class, IBinarySerializable, new()