akshay
akshay

Reputation: 1

Alternative of Dynamic Keyword in C# 3.5

Is there any alternative solution for dynamic keyword as I want to convert below code to c# 3.5.

public static dynamic ChangeTo(dynamic source, Type dest)
{
    return System.Convert.ChangeType(source, dest);
}

Upvotes: 0

Views: 3572

Answers (1)

Daniel Brückner
Daniel Brückner

Reputation: 59645

Well, you can just replace dynamic with Object because dynamic is essentially nothing more than Object but this will break almost all expressions involving members. It really depends on the code if this could work or will become a nightmare, i.e. if dynamic is used as intended it will become a nightmare.

Upvotes: 3

Related Questions