Creating/Working With Nullable Objects in PowerShell - How?

Hi,
how do I create and work with Nullable objects in PowerScript.
None of the tips I found worked:
> ([System.Nullable[System.Int32]]1).GetType().Name
Int32
> ([System.Nullable[System.Int32]]$null).GetType().Name
You can't call a method on a null value expression.
> (New-Object System.Nullable[Int32] 1).GetType().Name
Int32
Any help is appreciated!

Well, nullable: yes, but Nullable: no.
this is what I get in .NET if I call GetType() on a variable of type Nullable[Int32]:
int? a = null; a.GetType();
{Name = "Nullable`1" FullName = "System.Nullable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"}
    [System.RuntimeType]: {Name = "Nullable`1" FullName = "System.Nullable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"}
    base {System.Reflection.MemberInfo}: {Name = "Nullable`1" FullName = "System.Nullable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"}
    Assembly: {mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089}
    AssemblyQualifiedName: "System.Nullable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    Attributes: Public | SequentialLayout | Sealed | Serializable | BeforeFieldInit
    BaseType: {Name = "ValueType" FullName = "System.ValueType"}
    ContainsGenericParameters: false
    DeclaringMethod: "(typeof(int?)).DeclaringMethod" hat eine Ausnahme vom Typ "System.InvalidOperationException" verursacht.
    DeclaringType: null
    FullName: "System.Nullable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"
    GenericParameterAttributes: "(typeof(int?)).GenericParameterAttributes" hat eine Ausnahme vom Typ "System.InvalidOperationException" verursacht.
    GenericParameterPosition: "(typeof(int?)).GenericParameterPosition" hat eine Ausnahme vom Typ "System.InvalidOperationException" verursacht.
    GUID: {9a9177c7-cf5f-31ab-8495-96f58ac5df3a}
    HasElementType: false
    IsAbstract: false
    IsAnsiClass: true
    IsArray: false
    IsAutoClass: false
    IsAutoLayout: false
    IsByRef: false
    IsClass: false
    IsCOMObject: false
    IsContextful: false
    IsEnum: false
    IsExplicitLayout: false
    IsGenericParameter: false
    IsGenericType: true
    IsGenericTypeDefinition: false
    IsImport: false
    IsInterface: false
    IsLayoutSequential: true
    IsMarshalByRef: false
    IsNested: false
    IsNestedAssembly: false
    IsNestedFamANDAssem: false
    IsNestedFamily: false
    IsNestedFamORAssem: false
    IsNestedPrivate: false
    IsNestedPublic: false
    IsNotPublic: false
    IsPointer: false
    IsPrimitive: false
    IsPublic: true
    IsSealed: true
    IsSecurityCritical: false
    IsSecuritySafeCritical: false
    IsSecurityTransparent: true
    IsSerializable: true
    IsSpecialName: false
    IsUnicodeClass: false
    IsValueType: true
    IsVisible: true
    MemberType: TypeInfo
    Module: {CommonLanguageRuntimeLibrary}
    Namespace: "System"
    ReflectedType: null
    StructLayoutAttribute: {System.Runtime.InteropServices.StructLayoutAttribute}
    TypeHandle: {System.RuntimeTypeHandle}
    TypeInitializer: null
    UnderlyingSystemType: {Name = "Nullable`1" FullName = "System.Nullable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"}
That's quite a difference to PowerShell's:
([System.Nullable[System.Int32]]$null).GetType()
You can't call a method on an expression with value NULL.
See my point? PowerShell apparently doesn't have a notion about Nullable types. That's what I need to find out for myself: "Why?"
Best regards,
Axel Dahmen

Similar Messages

  • Working with Oracle Objects in JAVA - How-to do with views

    Hello,
    I am trying to access to Oracle object types from Java.
    My problem is, I have relational tables, Object Types and Object Views.
    All the examples I found from Oracle manuals are working with Object Tables(Table column is created as Object Type).
    You run a query and get this object type (oraconn.GetObject(1)) and the query is (SELECT * FROM Object_Table) so its get first column(which is an object type) and cast it to Java Class(with SQLDATA or ORADATA).
    The problem is that my data is in Relational Tables and I don't want to export them to Object tables.
    I want to get it from Object View.
    Is this possible? Or better is anybody has an example???
    Thx in advance

    Hi,
    I think you will be able to help me. your question made me to think that you will be able to help me. Here the question goes.
    I have a Stored Procedure which returns a user defined ROWTYPE(its a IN OUT param to the procedure). I need to call this procedure from my Java program. So I would like to know how to do it. Do we need to use any packages provided by oracle or some thing like that.
    thanks & regards,
    Anil.
    [email protected]

  • Working with Oracle Objects in JAVA - How to with views

    Hello,
    I am trying to access to Oracle object types from Java.
    My problem is, I have relational tables, Object Types and Object Views.
    All the examples I found from Oracle manuals are working with Object Tables(Table column is created as Object Type).
    You run a query and get this object type (oraconn.GetObject(1)) and the query is (SELECT * FROM Object_Table) so its get first column(which is an object type) and cast it to Java Class(with SQLDATA or ORADATA).
    The problem is that my data is in Relational Tables and I don't want to export them to Object tables.
    I want to get it from Object View.
    Is this possible? Or better is anybody has an example???
    Thx in advance

    Hi,
    I think you will be able to help me. your question made me to think that you will be able to help me. Here the question goes.
    I have a Stored Procedure which returns a user defined ROWTYPE(its a IN OUT param to the procedure). I need to call this procedure from my Java program. So I would like to know how to do it. Do we need to use any packages provided by oracle or some thing like that.
    thanks & regards,
    Anil.
    [email protected]

  • What is QueryAsAWebSerivces ? and How it works with Business Object XI Rel

    Hi Support,
    We have Business Object XI Rel 2 (Crystal report XI Rel 2, live Office and Excelsius 4.5).  I have taken the course on the SAP Online Learning site. "BU371e - Crystal Xcelsius: Designing Advanced Interactive Presentations.".  In the lesson 6, (see the screen beblow) I found out "QueryAsWebSerives" is very interested product because it allow me to connect  directly to a universe which has not been installed into my PC.  
    Could you please explain to me how to get "QueryAsWebServices" tool and How it supports or works with Bussiness Objects XI Rel 2?  What are the requirements for it?
    How can I see you the attachment screen?
    Thank in advance,
    Regards,
    Maria Pham
    Maria Pham / Corporate Reporting Analyst
    Frankston City Council u2014 Information Services
    Civic Centre, Corner Young & Davey Streets, Frankston, Vic, 3199
    Phone: 03 9784 1991   Fax: 03 9784 1833

    Hi
    QAAWS is part of the Productivity Pack of BOBJ XI R2. Productivity Pack comes for free and is compatible with the Service PAck 2 or higher.
    You can download the productivity pack from [here|service.sap.com/installations ]
    If you want to know how to use QAAWS please refer to the [Query as a Web Service Guide|http://help.sap.com/businessobject/product_guides/xir2PP/en/qaaws.pdf]
    Hope this helps!!!
    Regards
    Sourashree

  • How does operator 'less than' work with Rectangle objects?

    Just found in legacy code the following:
    private var firstRect:Rectangle;
    private var secondRect:Rectangle;
    if (firstRect < secondRect)
    // do something
    How does operator 'less than' work with Rectangle objects?
    Doc says that object is converted to number if it is not a String.
    Rectangle is not a String, though has conversion to String.
    Please help.

    IME the best way to know for sure is to experiment. The docs are only one person's best understanding of how things worked on the day, which is seldom 100% accurate. I find that even with code I wrote I can't accurately say 100% of what it does until I've worked with it for a while. Keep in mind that the docs are usually written when the code is written, so  never expect more than a rough idea from the docs.

  • A few of my pages don't work with Firefox nor Chrome. How do I fix this?

    I created my website from scratch (enjoyaquatics.com) but unfortunately a few of my pages don't work with Firefox nor Chrome. How do I fix this?
    Everything looks and works GREAT on Safari but not Firefox, Chrome, nor Internet Explorer.

    The pages look fine in FF and Chrome on my Mac. Didn't check with Win XP.
    If you use MSIE on a Mac, know that it became obsolete in 2003.
    I noticed what I call wobbly text on your pages. Here's the solution :
         iWeb : Prevent wobbly text in textboxes

  • My Adobe Acrobat 10 Pro creates PDFs with a graph background.  How do I make the background white?

    My Adobe Acrobat 10 Pro creates PDFs with a GRAPH background.  How do I make the scanned documents have a normal white background?

    This particular forum (sharing and storage) was created to help those transitioning from Photoshop.com to Adobe Revel. I will move your post to the correct forum so that it can get proper attention.
    We also have many other forums relating to other Adobe products at: http://forums.adobe.com.
    Out of curiosity, can you tell me how you found our forum page?

  • Geotagging - how can I edit new places that I have previously created but with typos, errors etc?  How do I delete a place I have set up?

    Geotagging - how can I edit new places that I have previously created but with typos, errors etc?  How do I delete a place I have set up?  Then I could create a new, correct entry.  I'm using iPhoto '09.

    Is it OK to reply to my own question?? Thanks to the related posts that appeared AFTER I'd made the post above, I learnt about the 'Manage my places' item under the Windows menu. I felt a bit dumb not knowing this.
    BUT it doesn't completely resolve the issue.  The info shown in the EXIF (using opt-cmd-I) under Places has the place name I choose, but it is followed by a few other lines that are incorrect and do not seem to be anything to do with any data I can see under 'Manage my places'.
    Can anyone explain where these other entries might come from, and how to edit them?

  • WF error: There are no workflows that have already worked with this object

    Hello all,
        I am getting the error "There are no workflows that have already worked with this object" when I go to IQS23--> enter notification number --> workflow overview. I tried to find information related to this error message but could not find anything. If anyone happen to know anything about this error, please let me know.
    Thanks.
    Mithun

    Hello,
    As the error message says, it can't find any workflows that have dealt with the instance of the object you're inquiring about.
    If you know this isn't true, or if you don't know what object this concerns, the you could try debug to see which object is being searched for.
    regards
    Rick Bakker
    Hanabi Technology

  • TS1363 ipod classic not working with win xp not sure how to sync it?

    ipod classic not working with win xp not sure how to sync it?

    Have you read this?
    iTunes: How to move your music to a new computer
    http://support.apple.com/kb/HT4527
    The Apple web site has lots of other guidance, for example if you are migrating from Windows to Mac, read this.
    Switch 101: Migrate your Windows files or system to your Mac
    http://support.apple.com/kb/HT2518

  • HT1338 My hp photo smart printer 5514 wont work with my 10.8 software, how do I fix this ?

    My hp photo smart printer 5514 wont work with my 10.8 software, how do I fix this ?

    It's supported. Open System Preferences > Print and Scan, press + button and press your printer

  • HT201274 Can a Sprint Iphone 5 work with T-mobile network? How can one unlock with the MSL code? Sprint is not abiding by the Unlocking Consumer Choice and Wireless Competition Act.  FCC will only enforce if we file more complains.

    Can a Sprint Iphone 5 work with T-mobile network? How can one unlock with the MSL code? Sprint is not abiding by the Unlocking Consumer Choice and Wireless Competition Act.  FCC will only enforce if we file more complains.

    T-Mobile is a GSM network whereas Sprint is a CDMA network. They are incompatible. Sprint is not obliged to unlock a phone that is still under contract. Their phones may not be capable of being unlocked.

  • I have 23 inch Apple HD Display. Will this work with my MacBook Pro? How shall I connect it?

    I have 23 inch Apple HD Display. Will this work with my MacBook Pro? How shall I connect it?

    yarova818,
    there were two different 23-inch Apple Cinema HD displays made. The first one was made between 2002 and 2004, and has an ADC connector. The second one was made between 2004 and 2008, and has a DVI-D connector.
    If you have the display with an ADC connector, then according to this Apple page, your display will work with your MacBook Pro if it’s a 13-inch or 15-inch model. If you have a first-generation MacBook Pro, you’d need an Apple DVI to ADC Adapter (or equivalent) to connect them. If you have a Unibody or Retina MacBook Pro, then you’d also need a Mini DisplayPort to DVI adapter (or equivalent) to complete the connection. A Retina model would also have the option of using a third-party HDMI to DVI-D adapter to complete the connection with the DVI to ADC adapter.
    If you have the display with a DVI-D connector, then if you have a first-generation MacBook Pro, you should be able to plug it in directly. If you have a Unibody or Retina MacBook Pro, then the Mini DisplayPort to DVI adapter would let you make the connection. Again, Retina models also would have the option of using a third-party HDMI to DVI-D adapter.

  • Working with smart objects

    I've got a menu I built in Photoshop that uses smart objects to warp and give perspective to both button text as well as pictures in the menu. I built the menu at 300dpi, then resized it to 72 for working in Encore.
    That 72dpi menu then became a template for other menus in the project.
    Encore does not support smart objects, it converts them to shape layers. Since I had done additional design work on the menu in Encore/Photoshop, I saved a copy of it to be a template. I then opened my original of this file and dragged the smart objects back into it for my template, so that I could create new buttons, etc. for other menus.
    I've since discovered that if I create a NEW smart object in that template, the smart object is at 72 dpi. However, if I modify an existing smart object, it's still at 300 dpi, even though the file is 72 dpi. Am I making any sense? So when I double click one of the original smart objects to, for example, change the text to create a new button, I get a large, 300dpi file to work with. The result is that the original smart objects are creating much sharper, cleaner text, and all my new smart objects are creating soft text. I've also discovered if I open one of the new smart objects and change it's size to 300dpi before creating the text layer, I can save it that way and the text is sharper and cleaner.
    I'm not sure what my question is... I guess I'm just sharing :-), but also wondering if my workaround has a downside that I don't see.
    The logical question you might be thinking is why don't I just build all the menus in 300 and then resize, and the answer is that I did a lot more work on the template after I had resized it for Encore and don't want to go back and redo all of that on the original file.
    Julie

    I'll test it without the warping and see what I learn and let you know, but I suspect I won't see a difference and you're right that warping the text may be more dependent on resolution.
    I just created a 72 dpi file with 2 identical smart objects, except one is 72dpi and the other is 300dpi. I then put the same text with the same layer style on each. There is a difference in the appearance, with the 300dpi smart object yielding cleaner, sharper looking text. When I remove the layer style on both so they're flat, no drop shadow or bevel, there is still a very discernible difference in sharpness. Also, when I export the images to a NTSC monitor, the difference is apparent.
    So it appears if you plan to warp text in a 72dpi graphic, you'll get better results if you increase the dpi of the smart object.

  • Working with PowerPoint objects in 7

    I'm evaluating Captivate 7, comparing it with Articulate Storyline.  One of the adverstised features of 7 is the ablity to import PowerPoint including, explicitly,  all object and animations. I have tried this and so far it only looks like it creates an image of the PowerPoint slide. I can't see how to directly interact with the PowerPoint shapes, text, etc. except by opening a linked PowerPoint session.  But I would like to create a drag and drop interaction with the objects in the PowerPoint slide, or apply other Captivate effects to the objects.  This is easily done in Articulate Storyline which turns the objects into Storyline objects.  Can I do the same in Captivate?  What am I missing?

    Hi folks
    Slight correction here. PowerPoint slides are imported and converted to Flash animations. (.SWF files) and the .SWF is set as the background image.
    Likely what is meant by importing all objects is that they are all included in the SWF? Not sure. Additionally, while any changes must be made using PowerPoint, Captivate has a way of opening PPT under its control to make changes.
    Cheers... Rick

Maybe you are looking for

  • Automated email using blobs in the database

    hi, I am wanting to have the facility for my db to send emails with attachments(with the file stored in the db) in an automated fashion. the things I have working at the moment. 1. I have got a DBMS_JOB working to handle the automated part. 2. I have

  • Curve 8530 White Screen, help please?

    I have a white screen. It did not get damaged or wet in any way. I can hear my phone ringing, hear alerts and see the LCD indicator light flashing. I cannot press any buttons to answer the phone or see the screen. The screen will only turn white when

  • Can't Paste Develop Settings to Multiple Photos

    I'm running Lightroom V3.2, and I have about 100 pictures I took at a concert.  I tweaked the exposure, brightness, etc, and the noise reduction, and copied the develop settings.  If I paste the settings onto any one photo, the paste works great.  Ho

  • BI Answers - need 2 compound layouts with tables with different columns

    Hi, I need 2 tables in the same report with different columns displaying. Is this possible? I wanted to put them in their own compound layout and call each one with a view selector, but it seems impossible to create a 2nd table with different columns

  • Error 0x80004005 occurs when installing LiveCycle ES4

    I am trying to install a recently purchased version of LiveCycle ES4 but I keep getting an error message )x80004005: Unspecified Error which appears to be associated with the CAB File.  Is there a solution to this problem.