---
title: "Osherove.Interception 1.04 - Change return values and incoming parameter values at runtime easily"
url: "https://osherove.com/blog/2004/10/19/osheroveinterception-104-change-return-values-and-incoming-p.md"
canonical: "https://osherove.com/blog/2004/10/19/osheroveinterception-104-change-return-values-and-incoming-p.html"
published: "2004-10-19T17:52:00"
updated: "2004-10-19T17:52:00"
tags: [".Net Original"]
author: "Roy Osherove"
description: "I just love the idea of interception. It lets you do stuff like this: using Osherove . Interception . Framework ; namespace Osherove . Interception . Samples . AutoEncryption { public class CryptTestedClass :…"
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# Osherove.Interception 1.04 - Change return values and incoming parameter values at runtime easily

By Roy Osherove October 19, 2004 In [.Net Original](https://osherove.com/blog/category/net-original)

**Historical article** · Originally published October 19, 2004; technical details may be outdated.

I just love the idea of interception. It lets you do stuff like this:

---

using Osherove.Interception.Framework;

namespace Osherove.Interception.Samples.AutoEncryption

{

      public class CryptTestedClass:InterceptableObject

      {

            \[EncryptOutput\]

            public string GetEncryptedValue(string someValue)

            {

                  //after this line someValue will be automatically

                  //encrypted and returned to the called in its new form

                  return someValue;

            }

            \[DecryptInput("encrypted")\]

            public string ReturnUnEncryptedString (string noChangeableValue,

                                                   string encrypted)

            {

                  //'encrypted' should already be in its unencrypted form in this stage

                  //so we just return it.

                  return encrypted;

            }

      }

}

---

and here are the tests(notice the the encryption example is just a simple string concatenation - for demo purposes.

---

            \[Test\]

            public void TestEncrypt()

            {

               CryptTestedClass myClass = new CryptTestedClass();

               string output  = myClass.GetEncryptedValue("SomeValue");

               Assert.AreEqual("SomeValue\*SomeEncryptStuffHere\*",output);

            }

            \[Test\]

            public void TestDecrypt()

            {

                  string encrypted = "SomeValue\*SomeEncryptStuffHere";

                  string decryptedOutput =

                     new CryptTestedClass().

                        ReturnUnEncryptedString("some string",encrypted);

                  Assert.AreEqual("SomeValue",decryptedOutput);

            }

---

If you want to be able to create such a feature, you'll need to download the latest version of my interception framework, version 1.0.4 [from here](https://osherove.com/LinkClick.aspx?link=http%3a%2f%2fwww.osherove.com%2fdownloads%2finterception104.zip&mid=347).

## More in .Net Original

[All posts in .Net Original](https://osherove.com/blog/category/net-original)

- Nov 17, 2004

    ### [Israeli .Net Deep Dive chat going on right now](https://osherove.com/blog/2004/11/17/israeli-net-deep-dive-chat-going-on-right-now.html)

- Nov 8, 2004

    ### [Simple math with regular expressions?](https://osherove.com/blog/2004/11/8/simple-math-with-regular-expressions.html)

- Oct 15, 2004

    ### [Solving Team Development with web projects hell](https://osherove.com/blog/2004/10/15/solving-team-development-with-web-projects-hell.html)

- Oct 15, 2004

    ### [\[Tools and Addins\] : SharpTools, web controls and various utilities - free!](https://osherove.com/blog/2004/10/15/tools-and-addins-sharptools-web-controls-and-various-utiliti.html)


---

## About the author

**Roy Osherove**: Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

- [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
- [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
- [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
- [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
- [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
- [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

- X: https://x.com/royosherove
- LinkedIn: https://www.linkedin.com/in/osherove/

### Contact

- Contact form: https://forms.gle/jQSx5KoXvrVA1JCK7

### License

Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page). License: https://creativecommons.org/licenses/by/4.0/
