The results of Powershell ISE and PSS execution are different

Use this forum to ask questions after your subscription maintenance expires or before you buy. Need information on licensing or pricing? Questions about a trial version? This is the right place for you. No scripting questions, please.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
This topic is 1 year and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
davaleng
Posts: 6
Last visit: Wed Aug 10, 2022 10:36 pm

The results of Powershell ISE and PSS execution are different

Post by davaleng »

Hello
I have a piece of code that gets different results after executing in powershell ise and in powershell studio, Take a look at the image demonstration below

PowerShell Studio 2022, Version & Build: 5.8.209

My system: windows7 64bit
abc.gif
abc.gif (336.81 KiB) Viewed 15934 times
powershell script code:

Code: Select all

$source = @"
public class classA
{
	private string name;
	public classA(string str)
	{
		this.name = str;
	}
	public string Name
	{
		get { return this.name; }
		set { this.name = value; }
	}
	public void sayHello()
	{
		System.Console.WriteLine("hello, " + this.Name);
	}
}
"@

Add-Type -TypeDefinition $source;

$myObject = New-Object classA("langhunld");
$myObject.Name;
$myObject.sayHello();
$myObject.Name = "Not Set";
$myObject.Name;
$myObject.sayHello();
This topic is 1 year and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.