Home > Net >  Try to write a Dictionary extension method c #, but how to write there will be an error
Try to write a Dictionary extension method c #, but how to write there will be an error

Time:04-21


So write complains "extension method must be defined in the generic static class"

So write complains again "found no namespace TKey and TValue"
Where is my writing grammar is there a problem

CodePudding user response:

 

Public static class Obj
{
Public static SerializableAttribute Toabc (this Dictionary Daa)
{
Return the default;

}
}

CodePudding user response:

In the second method, please add toxxxxx< toxxxxx out; T1, T2 & gt;

Mobile phone reply, is not convenient to knock the code, it is good to understand you mean

CodePudding user response:

The compiler cannot explain the generic code, this is the reason why c # did not provide a Dictionary type serialization
Otherwise, Microsoft c # development engineers will not pass the defect

C # to solve the Dictionary cannot be serialized

CodePudding user response:

Linq to XML, do the wheels have to smart Aleck, amusing!
  •  Tags:  
  • C#
  • Related