Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8816087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:32:07+00:00 2026-06-14T04:32:07+00:00

Okay… I’m trying to pass an Object which I declare in C# to a

  • 0

Okay… I’m trying to pass an Object which I declare in C# to a Python file with IronPython.

So this is what I was thinking off:

C# class:

public class ParamObj
{
   private string Obj_String;
   private int Obj_Int;

   public ParamObj(string lObjS, string lObjI)
   {
      Obj_String = lObjS;
      Obj_Int = lObjI;
   }

   public string getString()
   {
      return Obj_String;
   }

   public int getInt()
   {
      return Obj_Int;
   }

   public setString(string lStr)
   {
      Obj_String = lStr;
   }

   public setInt(int lInt)
   {
      Obj_Int = lInt;
   }
}

So i have my Class.. Now i declare the Class in my C# Project and i pass it to the PYthon file:

ParamObj Test_Object = new ParamObj("Test Object from C#", 1337);
var ipy = Python.CreateRuntime();
dynamic Test = ipy.UseFile("Test.py");

Test_Object = Test.ObjectAsParam(Test_Object);

Console.WriteLine(Test_Object.getString(), Convert.ToString(Test_Object.getInt()));

And now I want to use the Object in my Pythoin file and call it’s methods.
So and the Code in my Test.py is as follows:

def ObjectAsParam(Obj):

    print Obj.getString()
    print str(Obj.getInt())

    Obj.setString("Changed!")
    Obj.setInt(1338)

    return Obj

But my Compiler says that the python script doesn’t know the Methods
getString(), getInt() etc.

So is there a way to manage that ?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T04:32:08+00:00Added an answer on June 14, 2026 at 4:32 am

    Make sure ParamObj is a public class.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay I know right off the bat this is going to be a stupid
Okay, so I'm trying to make a game that uses this algorithm: http://www.codeproject.com/Articles/15573/2D-Polygon-Collision-Detection But
Okay I've spent the last hour trying to find a solution to this but
Okay so I can't figure this out. Like a file that I using grep
Okay, so I have this class that basically acts as a manager of an
Okay this question is very simple: I have a facebook page, and a website.
Okay, I feel a bit foolish for having to ask this but I guess
Okay, this is probably a very basic question; but, I'm just getting back in
Okay suppose I have an array of objects that look like this: obj(from, to)
Okay first the code.. <td class=btnSaveBooking> <div class=btnSaveBookingContainder> <div id=save> <span class=btnImage></span><span class=btnsavebookingspan> <input

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.