Asked  7 Months ago    Answers:  5   Viewed   55 times

The goal is to unserialize a PHP serialized string and get sutable object in C#

Is there any way to make this possible in C#(.Net)?

To be more specific: We need to make an application which comunicates (Via HTTP) to specific website which returns the needed information. Fortunately/unfortunately we dont have permission to website so the data (array mostly) that is returned from website is PHP serialized.



Found solution: Sharp Serialization Library

Wednesday, March 31, 2021
answered 7 Months ago

Use .unserializeSession() instead of .unserialize().

Saturday, May 29, 2021
answered 5 Months ago

If you serialized an instance of List< MyClass > from your version assembly, the SerializationBinder.BindToType function will be asked to provide this type:

System.Collections.Generic.List`1[[MyAssembly.MyClass, MyAssembly, Version=, Culture=neutral, PublicKeyToken=12345678901234567890]]

In order to remap the List< MyClass > type to your version assembly, you need to change the type name to this:

System.Collections.Generic.List`1[[MyAssembly.MyClass, MyAssembly]]

The main point to note, is that the assembly name is not fully qualified. If you try to fully qualify the assembly name with a version number, it will not work.

Friday, July 30, 2021
answered 3 Months ago

It could look like this:

#include <iostream>
#include <sstream>
using namespace std;

int main()
    istringstream is("1n2n3n4nn5n");
    string s;
    while (getline(is, s))
        if (s.empty())
            cout << "Empty line." << endl;
            istringstream tmp(s);
            int n;
            tmp >> n;
            cout << n << ' ';
    cout << "Done." << endl;
    return 0;


1 2 3 4 Empty line.
5 Done.

Hope this helps.

Monday, August 9, 2021
answered 3 Months ago

You could hook the AppDomain.AssemblyResolve event to load the assemblies as they are needed. the event is raised each time that the runtime needs an assembly that it cannot resolve. It gives you one last chance to provide the assembly before the "Unable to find assembly" exception is thrown. Examples are on the page that I linked.

Monday, August 30, 2021
Andrei Urse
answered 2 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :