Class Instantiation

Posted on 2011-09-07
Last Modified: 2012-06-27
Dear all

As I am not uptodate with new technology :-)
I need to create an instance of the class below and call the method  <<public DownloadFile[] GetProcessProtocol>>
and print the result in a console... using Window Console project..

a snippet of the <<  static void Main(string[] args) >> declaration will be appericated..

Thanks in advance
public partial class CallerDownloadServices : System.Web.Services.Protocols.SoapHttpClientProtocol
	 public DownloadFile[] GetProcessProtocol(string CallerID, System.DateTime CreateDate, bool ArchiveData) {
        object[] results = this.Invoke("GetProcessProtocol", new object[] {
        return ((DownloadFile[])(results[0]));
	 public DownloadFile[] Result {
        get {
            return ((DownloadFile[])(this.results[0]));

Open in new window

Question by:ZURINET
  • 2
  • 2

Accepted Solution

yesthatbob earned 500 total points
ID: 36497892
This would depend on what the DownloadFile class looks like. That's the only way to know how you would print the value of what is returned by CallerDownloadServices.GetProcessProtocol(). However, let's say for argument's sake that there is a ToString() method on the DownloadFile class that returns the value you would want to print. You code should look like this.

static void Main(string[] args)
	string callerId = "your caller ID here";	// you'll need to set your caller ID value
	DateTime createDate = DateTime.Now;		// you'll need to set your create date value
	bool archiveData = true;			// you'll need to set your archive data flag
	// Create an instance of CallerDownloadServices
	CallerDownloadServices dlServices = new CallerDownloadServices();

	// Call GetProcessProtocol to get the DownloadFiles
	DownloadFile[] dlFiles = dlServices.GetProcessProtocol(callerId, createDate, archiveData);

	// Cycle through the DownloadFiles to get each value
	foreach (DownloadFile file in dlFiles)
		// Print each value to the console

Open in new window


Author Comment

ID: 36497972
Hi bob

Thanks for prompt reply

attached is the download class

How will the code look like then?
public partial class DownloadFile {
    private byte[] dataField;
    private string filenameField;
    /// <remarks/>
    public byte[] Data {
        get {
            return this.dataField;
        set {
            this.dataField = value;
    /// <remarks/>
    public string Filename {
        get {
            return this.filenameField;
        set {
            this.filenameField = value;

Open in new window


Expert Comment

ID: 36498085 you want to print the file contents, of the filename?

If it's the filename, simply change line 17 in my example to:


Open in new window

If it's the contents (Data property), things get a bit trickier, because the data could be binary and not play well when printed at the console.

Author Comment

ID: 36498127
Just want to make sure that I can access the Webservice....
The file will be passed on to a customer..

Thanks once again

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
which object should i use (efficiency) 5 46
Need to pass stored proc parameters in list 13 32
Problem with Filesystemobject or .NET version 3 35
Export import database 4 43
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now