Click here to Skip to main content
15,884,908 members

Comments by Member 3975629 (Top 66 by date)

Member 3975629 28-Aug-15 3:42am View    
Hi Sergey ,

I am trying as below .but I am getting an error CS0411: as follows. any idea ?
Here "TopicDetails" is a datacontract class which has string data members.

List<TopicDetails> topicDetails3;
TopicDetails[] arr = topicDetails3.ToArray();

int[] myInts = Array.ConvertAll(arr, int.Parse);

error CS0411: The type arguments for method 'System.Array.ConvertAll<tinput,toutput>(TInput[], System.Converter<tinput,toutput>)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
Member 3975629 28-Aug-15 1:58am View    
If I use topicDetails.ToArray(); I am getting the error:

Cannot implicitly convert type 'Data.Notif.TopicDetails[]' to 'string[]' .

I think it is because "TopicDetails" is of type data contract "Data.Notif.TopicDetails"

I am not sure how to resolve this error.
Could you please let us know how to resolve this error.
Member 3975629 28-Aug-15 1:21am View    
Hi Sergey ,

I have added more detail here. As you suggested List has ToArray method.

I am little confused here. Because in C# , I have the following code

subscriptionTopicList.Add(SubscriptionTopic.CreateSubscriptions<List<topicdetails>, string>(topicDetails, "VIEW"));

Now if I use topicDetails.ToArray(); will it convert this to an integer array which I can pass to C++/CLI
and then to native C++ code as const vector<int> &optList ??

Appreciate your help.

Thanks
Member 3975629 27-Aug-15 7:14am View    
I need to convert the to convert a List of data contracts to an integer array[].
from C# to an Integer array[] in C++/CLI and then to C++ .

I need to convert from C# , List of datacontract to C++ const integer vector &topicList via C++/CLI wrapper.

Could you please let me know how can I achieve this.

Appreciate your help on this.

//topicDetails is a data-contract
CreateSubscriptions<List<topicdetails>(topicDetails);

//Here TopicDetails is a class (data contract) as follows.

public class TopicDetails
{
protected object baseObjectType; //string
protected object topic; //string

public TopicDetails();

[DataMember]
public object BaseObjectType { get; set; }
[DataMember]
public object TopicID { get; set; }

public static TopicDetails CreateTopic<t, mt="">(IComparable<t> objectType, IComparable<mt> objectID);
}


http://www.codeproject.com/Questions/1022559/How-to-convert-a-List-of-DataContracts-to-an-to-an?arn=0
Member 3975629 27-Aug-15 5:29am View    
As you asked ,

I need to convert from C# , List of datacontract to C++ const integer vector &topicList via C++/CLI wrapper.

I need to pass List of data contract to C++/CLI and then to C++
I need to convert List of data contracts from C# to an integer array in C++ thru a wrapper classes. Please see the details in the below link. And please provide your suggestions on how to achieve this. Thanks..

http://www.codeproject.com/Questions/1022559/How-to-convert-a-List-of-DataContracts-to-an-to-an?arn=0