Avvenimenti
Mar 17, 11 PM - Mar 21, 11 PM
Ingħaqad mas-serje meetup biex tibni soluzzjonijiet skalabbli tal-IA bbażati fuq każijiet ta 'użu fid-dinja reali ma' żviluppaturi u esperti sħabi.
Irreġistra issaDan il-brawżer m'għadux appoġġjat.
Aġġorna għal Microsoft Edge biex tieħu vantaġġ mill-aħħar karatteristiċi, aġġornamenti tas-sigurtà, u appoġġ tekniku.
This article covers the following compiler errors:
type1
' and 'type2
'ref
and out
.OverloadResolutionPriorityAttribute
' on an overriding member.OverloadResolutionPriorityAttribute
' on this member.In addition, the following compiler warning:
ref
or out
, or in array rank, is not CLS-compliantref
and out
.In addition, the following compiler warning:
ref
or out
, or in array rank, is not CLS-compliantWhen you create overloaded operators in your class, the signature must match the number of parameters required for that operator. You have the wrong number of parameters in the operator definition.
In addition, overload operators must use the defined operator name. The only exception is when you create a conversion operator, where the operator name matches the return type of the conversion.
These errors indicate that you created overloads that aren't different. Common reasons include:
M(dynamic)
and M(object)
, or M2(string)
and M2(string?)
.M(ref int)
and M(out int)
.init
and a set
accessor for a property.Your code calls a method where the name exists, but some arguments are incorrect, or you've used the wrong number of arguments. If you're trying to call an extension method, the containing class might be in a namespace that's not imported.
Nota
Error CS1928
isn't used by the latest compilers. Newer compilers use CS1929
exclusively.
type1
' and 'type2
'These errors indicate there isn't one better overload than others. There are several possible causes for these errors:
Different arguments are better for each parameter. One might be an exact match and the other requires a conversion:
void M(int a, double b) { }
void M(double a, int b) {}
M(1, 1); // ambiguous
Multiple user defined conversion operators are candidates. Conversion operators can be declared in the source type, its base types, the destination type, or its base types. If a conversion operator was defined in more than one, the compiler can't pick.
Multiple conversion operators could perform a compatible conversion.
One or more arguments uses default
(not default(T)
) and multiple types could be chosen.
In most of these cases, adding an explicit cast can specify which overload should be chosen.
OverloadResolutionPriorityAttribute
' on an overriding member.OverloadResolutionPriorityAttribute
' on this member.Your code violated the rules for using the OverloadResolutionPriorityAttribute to favor one overload instead of another. You can't apply the OverloadResolutionPriorityAttribute
to the following method types:
In addition, you can't apply the OverloadResolutionPriorityAttribute
to an override
of a virtual
or abstract
member. The compiler uses the value from the base type declaration.
Feedback ta’ .NET
.NET huwa proġett b’sors miftuħ. Agħżel link biex tipprovdi l-feedback:
Avvenimenti
Mar 17, 11 PM - Mar 21, 11 PM
Ingħaqad mas-serje meetup biex tibni soluzzjonijiet skalabbli tal-IA bbażati fuq każijiet ta 'użu fid-dinja reali ma' żviluppaturi u esperti sħabi.
Irreġistra issa